#ifndef _BASE64_HTML_H
#define _BASE64_HTML_H
static const char *html_code_base64 = "PGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPgogICAgPGhlYWQ+CiAgICA8dGl0bGU+SGl0YXNrIE1vbml0b3I8L3RpdGxlPgogICAgPG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9VVRGLTgiPgogICAgPHN0eWxlPgogICAgICAgIGJvZHkuSUVfTTcsIGJvZHkuSUVfTTgsIGJvZHkuV2luNntmb250LWZhbWlseToiU2Vnb2UgVUkiLCBUYWhvbWEsIFZlcmRhbmEsIEFyaWFsO30KICAgICAgICBib2R5LlNhZmFyaXttaW4td2lkdGg6OTg3cHg7fQogICAgICAgIGJvZHkuU0ZfaVBob25ley13ZWJraXQtdGV4dC1zaXplLWFkanVzdDpub25lO30KICAgICAgICBib2R5CiAgICAgICAgewogICAgICAgICAgICBtYXJnaW46MDtmb250LWZhbWlseTpUYWhvbWEsIFZlcmRhbmEsIEFyaWFsOwogICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiNGNEZCRkY7CiAgICAgICAgICAgIGNvbG9yOiMzMzM7CiAgICAgICAgICAgIGZvbnQtc2l6ZToxMnB0OwogICAgICAgICAgICB3aWR0aDoxMDAlOwogICAgICAgICAgICBoZWlnaHQ6MTAwJTsKICAgICAgICB9CiAgICAgICAgICAgICNtYWluZnJhbWUKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcG9zaXRpb246cmVsYXRpdmU7CiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiNGNEZCRkY7CiAgICAgICAgICAgICAgICB6LWluZGV4OjA7CiAgICAgICAgICAgICAgICB3aWR0aDoxMDAlOwogICAgICAgICAgICAgICAgaGVpZ2h0OjEwMCU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgI2l0YWIge3Bvc2l0aW9u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C0xLCAtMSwKICAgICAgICAgICAgICAgIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgNjIsIC0xLCAtMSwgLTEsIDYzLAogICAgICAgICAgICAgICAgNTIsIDUzLCA1NCwgNTUsIDU2LCA1NywgNTgsIDU5LCA2MCwgNjEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsCiAgICAgICAgICAgICAgICAtMSwgIDAsICAxLCAgMiwgIDMsICA0LCAgNSwgIDYsICA3LCAgOCwgIDksIDEwLCAxMSwgMTIsIDEzLCAxNCwKICAgICAgICAgICAgICAgIDE1LCAxNiwgMTcsIDE4LCAxOSwgMjAsIDIxLCAyMiwgMjMsIDI0LCAyNSwgLTEsIC0xLCAtMSwgLTEsIC0xLAogICAgICAgICAgICAgICAgLTEsIDI2LCAyNywgMjgsIDI5LCAzMCwgMzEsIDMyLCAzMywgMzQsIDM1LCAzNiwgMzcsIDM4LCAzOSwgNDAsCiAgICAgICAgICAgICAgICA0MSwgNDIsIDQzLCA0NCwgNDUsIDQ2LCA0NywgNDgsIDQ5LCA1MCwgNTEsIC0xLCAtMSwgLTEsIC0xLCAtMSk7CiAgICAgICAgICAgIGZ1bmN0aW9uIGJhc2U2NGVuY29kZShzdHIpIAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgb3V0LCBpLCBsZW47CiAgICAgICAgICAgICAgICB2YXIgYzEsIGMyLCBjMzsKCiAgICAgICAgICAgICAgICBsZW4gPSBzdHIubGVuZ3RoOwogICAgICAgICAgICAgICAgaSA9IDA7CiAgICAgICAgICAgICAgICBvdXQgPSAiIjsKICAgICAgICAgICAgICAgIHdoaWxlKGkgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICBjMSA9IHN0ci5jaGFyQ29kZUF0KGkrKykgJiAweGZmOwogICAgICAgICAgICAgICAgICAgIGlmKGkgPT0gbGVuKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IGJhc2U2NEVuY29kZUNoYXJzLmNoYXJBdChjMSA+PiAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IGJhc2U2NEVuY29kZUNoYXJzLmNoYXJBdCgoYzEgJiAweDMpIDw8IDQpOwogICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gIj09IjsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGMyID0gc3RyLmNoYXJDb2RlQXQoaSsrKTsKICAgICAgICAgICAgICAgICAgICBpZihpID09IGxlbikKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIG91dCArPSBiYXNlNjRFbmNvZGVDaGFycy5jaGFyQXQoYzEgPj4gMik7CiAgICAgICAgICAgICAgICAgICAgICAgIG91dCArPSBiYXNlNjRFbmNvZGVDaGFycy5jaGFyQXQoKChjMSAmIDB4Myk8PCA0KSB8ICgoYzIgJiAweEYwKSA+PiA0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG91dCArPSBiYXNlNjRFbmNvZGVDaGFycy5jaGFyQXQoKGMyICYgMHhGKSA8PCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9ICI9IjsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGMzID0gc3RyLmNoYXJDb2RlQXQoaSsrKTsKICAgICAgICAgICAgICAgICAgICBvdXQgKz0gYmFzZTY0RW5jb2RlQ2hhcnMuY2hhckF0KGMxID4+IDIpOwogICAgICAgICAgICAgICAgICAgIG91dCArPSBiYXNlNjRFbmNvZGVDaGFycy5jaGFyQXQoKChjMSAmIDB4Myk8PCA0KSB8ICgoYzIgJiAweEYwKSA+PiA0KSk7CiAgICAgICAgICAgICAgICAgICAgb3V0ICs9IGJhc2U2NEVuY29kZUNoYXJzLmNoYXJBdCgoKGMyICYgMHhGKSA8PCAyKSB8ICgoYzMgJiAweEMwKSA+PjYpKTsKICAgICAgICAgICAgICAgICAgICBvdXQgKz0gYmFzZTY0RW5jb2RlQ2hhcnMuY2hhckF0KGMzICYgMHgzRik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gb3V0OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGJhc2U2NGRlY29kZShzdHIpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBjMSwgYzIsIGMzLCBjNDsKICAgICAgICAgICAgICAgIHZhciBpLCBsZW4sIG91dDsKCiAgICAgICAgICAgICAgICBsZW4gPSBzdHIubGVuZ3RoOwogICAgICAgICAgICAgICAgaSA9IDA7CiAgICAgICAgICAgICAgICBvdXQgPSAiIjsKICAgICAgICAgICAgICAgIHdoaWxlKGkgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAvKiBjMSAqLwogICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgYzEgPSBiYXNlNjREZWNvZGVDaGFyc1tzdHIuY2hhckNvZGVBdChpKyspICYgMHhmZl07CiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZShpIDwgbGVuICYmIGMxID09IC0xKTsKICAgICAgICAgICAgICAgICAgICBpZihjMSA9PSAtMSkKICAgICAgICAgICAgICAgICAgICBicmVhazsKCiAgICAgICAgICAgICAgICAgICAgLyogYzIgKi8KICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMyID0gYmFzZTY0RGVjb2RlQ2hhcnNbc3RyLmNoYXJDb2RlQXQoaSsrKSAmIDB4ZmZdOwogICAgICAgICAgICAgICAgICAgIH0gd2hpbGUoaSA8IGxlbiAmJiBjMiA9PSAtMSk7CiAgICAgICAgICAgICAgICAgICAgaWYoYzIgPT0gLTEpCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CgogICAgICAgICAgICAgICAgICAgIG91dCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKChjMSA8PCAyKSB8ICgoYzIgJiAweDMwKSA+PiA0KSk7CgogICAgICAgICAgICAgICAgICAgIC8qIGMzICovCiAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICBjMyA9IHN0ci5jaGFyQ29kZUF0KGkrKykgJiAweGZmOwogICAgICAgICAgICAgICAgICAgICAgICBpZihjMyA9PSA2MSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG91dDsKICAgICAgICAgICAgICAgICAgICAgICAgYzMgPSBiYXNlNjREZWNvZGVDaGFyc1tjM107CiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZShpIDwgbGVuICYmIGMzID09IC0xKTsKICAgICAgICAgICAgICAgICAgICBpZihjMyA9PSAtMSkKICAgICAgICAgICAgICAgICAgICBicmVhazsKCiAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKChjMiAmIDBYRikgPDwgNCkgfCAoKGMzICYgMHgzQykgPj4gMikpOwoKICAgICAgICAgICAgICAgICAgICAvKiBjNCAqLwogICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgYzQgPSBzdHIuY2hhckNvZGVBdChpKyspICYgMHhmZjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoYzQgPT0gNjEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGM0ID0gYmFzZTY0RGVjb2RlQ2hhcnNbYzRdOwogICAgICAgICAgICAgICAgICAgIH0gd2hpbGUoaSA8IGxlbiAmJiBjNCA9PSAtMSk7CiAgICAgICAgICAgICAgICAgICAgaWYoYzQgPT0gLTEpCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKChjMyAmIDB4MDMpIDw8IDYpIHwgYzQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIG91dDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB1dGYxNnRvOChzdHIpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBvdXQsIGksIGxlbiwgYzsKICAgICAgICAgICAgICAgIG91dCA9ICIiOwogICAgICAgICAgICAgICAgbGVuID0gc3RyLmxlbmd0aDsKICAgICAgICAgICAgICAgIGZvcihpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KGkpOwogICAgICAgICAgICAgICAgICAgIGlmICgoYyA+PSAweDAwMDEpICYmIChjIDw9IDB4MDA3RikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IHN0ci5jaGFyQXQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYyA+IDB4MDdGRikgewogICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgweEUwIHwgKChjID4+IDEyKSAmIDB4MEYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoMHg4MCB8ICgoYyA+PiAgNikgJiAweDNGKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG91dCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKDB4ODAgfCAoKGMgPj4gIDApICYgMHgzRikpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgweEMwIHwgKChjID4+ICA2KSAmIDB4MUYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoMHg4MCB8ICgoYyA+PiAgMCkgJiAweDNGKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIG91dDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB1dGY4dG8xNihzdHIpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBvdXQsIGksIGxlbiwgYzsKICAgICAgICAgICAgICAgIHZhciBjaGFyMiwgY2hhcjM7CiAgICAgICAgICAgICAgICBvdXQgPSAiIjsKICAgICAgICAgICAgICAgIGxlbiA9IHN0ci5sZW5ndGg7CiAgICAgICAgICAgICAgICBpID0gMDsKICAgICAgICAgICAgICAgIHdoaWxlKGkgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICBjID0gc3RyLmNoYXJDb2RlQXQoaSsrKTsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2goYyA+PiA0KQogICAgICAgICAgICAgICAgICAgIHsgCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDogY2FzZSAxOiBjYXNlIDI6IGNhc2UgMzogY2FzZSA0OiBjYXNlIDU6IGNhc2UgNjogY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAvLyAweHh4eHh4eAogICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gc3RyLmNoYXJBdChpLTEpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjogY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgLy8gMTEweCB4eHh4ICAgMTB4eCB4eHh4CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gc3RyLmNoYXJDb2RlQXQoaSsrKTsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKChjICYgMHgxRikgPDwgNikgfCAoY2hhcjIgJiAweDNGKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OgogICAgICAgICAgICAgICAgICAgICAgICAvLyAxMTEwIHh4eHggIDEweHggeHh4eCAgMTB4eCB4eHh4CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gc3RyLmNoYXJDb2RlQXQoaSsrKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2hhcjMgPSBzdHIuY2hhckNvZGVBdChpKyspOwogICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoKGMgJiAweDBGKSA8PCAxMikgfAogICAgICAgICAgICAgICAgICAgICAgICAoKGNoYXIyICYgMHgzRikgPDwgNikgfAogICAgICAgICAgICAgICAgICAgICAgICAoKGNoYXIzICYgMHgzRikgPDwgMCkpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgcmV0dXJuIG91dDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBzdGFydF93YWl0KCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5zdHlsZS5jdXJzb3IgPSAnd2FpdCc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gb3Zlcl93YWl0KCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5zdHlsZS5jdXJzb3IgPSAnYXV0byc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYmFzZTY0c3RyZGVjb2RlKHN0cikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1dGY4dG8xNihiYXNlNjRkZWNvZGUoc3RyKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gdHJpbShzdHIpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHJldHVybiBzdHIucmVwbGFjZSgvKF5ccyt8XHMrJCkvLCAiIik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gaGlnaGxpZ2h0KG9iaikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgb2JqLmNsYXNzTmFtZSA9ICJidGl0bGUiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGJhY2tjc3Mob2JqKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBvYmouY2xhc3NOYW1lID0gInRpdGxlIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBvdmVyQkZyYW1lKGVsZW1lbnQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBiZnJhbWUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnYmZyYW1lJyk7CiAgICAgICAgICAgICAgICBpZihiZnJhbWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgYmZyYW1lLnN0eWxlLmxlZnQgPSBlbGVtZW50Lm9mZnNldExlZnQrInB4IjsKICAgICAgICAgICAgICAgICAgICBiZnJhbWUuc3R5bGUudG9wID0gZWxlbWVudC5vZmZzZXRUb3ArInB4IjsKICAgICAgICAgICAgICAgICAgICBiZnJhbWUuc3R5bGUud2lkdGggPSBlbGVtZW50Lm9mZnNldFdpZHRoKyJweCI7CiAgICAgICAgICAgICAgICAgICAgYmZyYW1lLnN0eWxlLmhlaWdodCA9IGVsZW1lbnQub2Zmc2V0SGVpZ2h0KyJweCI7CiAgICAgICAgICAgICAgICAgICAgYmZyYW1lLnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBoaWRlQkZyYW1lKCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGJmcmFtZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdiZnJhbWUnKTsKICAgICAgICAgICAgICAgIGJmcmFtZS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHJlbW92ZUVsZW1lbnQoX2VsZW1lbnQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBfcGFyZW50RWxlbWVudCA9IF9lbGVtZW50LnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICBpZihfcGFyZW50RWxlbWVudCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBfcGFyZW50RWxlbWVudC5yZW1vdmVDaGlsZChfZWxlbWVudCk7ICAKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBoaWRlQkZyYW1lKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gQ3JlYXRlWE1MSFRUUCgpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB4bWxodHRwID0gbnVsbDsKICAgICAgICAgICAgICAgIHhtbGh0dHBPYmogPSBbIk1TWE1MMi5YbWxIdHRwLjUuMCIsIk1TWE1MMi5YbWxIdHRwLjQuMCIsCiAgICAgICAgICAgICAgICAiTVNYTUwyLlhtbEh0dHAuMy4wIiwiTVNYTUwyLlhtbEh0dHAiLCJNaWNyb3NvZnQuWG1sSHR0cCJdOwogICAgICAgICAgICAgICAgaWYod2luZG93LlhNTEh0dHBSZXF1ZXN0KQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHhtbGh0dHAgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYod2luZG93LkFjdGl2ZVhPYmplY3QpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZm9yKGk9MDtpPHhtbGh0dHBPYmoubGVuZ3RoO2krKykgICAgCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICB0cnl7eG1saHR0cCA9IG5ldyBBY3RpdmVYT2JqZWN0KHhtbGh0dHBPYmpbaV0pO2JyZWFrO30KICAgICAgICAgICAgICAgICAgICAgICAgY2F0Y2goZSl7eG1saHR0cCA9IG51bGw7fQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgYWxlcnQoJ0NhbiBub3QgY3JlYXRlIFhNTEhUVFAgT2JqZWN0Jyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4geG1saHR0cDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiByZWJ1aWxkQ2hpbGQob1BhcmVudCwgcGlkLCBpZCwgbmFtZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYob1BhcmVudCAmJiBwYXJzZUludChpZCkgPiAwICYmIG5hbWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHN0cmNoaWxkcyA9IG9QYXJlbnQuZ2V0QXR0cmlidXRlKCdjaGlsZHMnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgcE5hbWUgPSBvUGFyZW50LmdldEF0dHJpYnV0ZSgnVU5hbWUnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgY2hpbGRzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZihzdHJjaGlsZHMpIGNoaWxkcyA9IGV2YWwoc3RyY2hpbGRzKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGNoaWxkcyA9IG5ldyBBcnJheSgpOwogICAgICAgICAgICAgICAgICAgIGNoaWxkc1tpZF0gPSBuYW1lOwogICAgICAgICAgICAgICAgICAgIHN0cmNoaWxkcyA9ICIoeyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvcih4IGluIGNoaWxkcykKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeCAhPSBwaWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJjaGlsZHMgKz0geCsiOiciK2NoaWxkc1t4XSsiJywiOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmNoaWxkcyArPSBwaWQrIjonIitwTmFtZSsiJ30pIjsKICAgICAgICAgICAgICAgICAgICBvUGFyZW50LnNldEF0dHJpYnV0ZSgnY2hpbGRzJywgc3RyY2hpbGRzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiByZW1vdmVDaGlsZChvUGFyZW50LCBwaWQsIGlkKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZihvUGFyZW50ICYmIHBhcnNlSW50KGlkKSA+IDApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHN0cmNoaWxkcyA9IG9QYXJlbnQuZ2V0QXR0cmlidXRlKCdjaGlsZHMnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgcE5hbWUgPSBvUGFyZW50LmdldEF0dHJpYnV0ZSgnVU5hbWUnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgY2hpbGRzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZihzdHJjaGlsZHMpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHMgPSBldmFsKHN0cmNoaWxkcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkc1tpZF0gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyY2hpbGRzID0gIih7IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcih4IGluIGNoaWxkcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih4ICE9IHBpZCAmJiBjaGlsZHNbeF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmNoaWxkcyArPSB4KyI6JyIrY2hpbGRzW3hdKyInLCI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJjaGlsZHMgKz0gcGlkKyI6JyIrcE5hbWUrIid9KSI7CiAgICAgICAgICAgICAgICAgICAgICAgIG9QYXJlbnQuc2V0QXR0cmlidXRlKCdjaGlsZHMnLCBzdHJjaGlsZHMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBBZGROb2RlKHBpZCwgaWQsIG5hbWUsIGNvdW50KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZihkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgibm9kZSIraWQpICE9IG51bGwpIHJldHVybjsKICAgICAgICAgICAgICAgIC8vYWxlcnQoInBpZDoiK3BpZCsiaWQ6IitpZCsibmFtZToiK25hbWUpOwogICAgICAgICAgICAgICAgdmFyIG9QYXJlbnQgPSBudWxsOwogICAgICAgICAgICAgICAgaWYocGlkID49IDApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgb1BhcmVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJub2RlIitwaWQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIG9QYXJlbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndHJlZWJvZHknKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC8vYWxlcnQocGlkKyc6JytpZCsnOicrbmFtZSk7CiAgICAgICAgICAgICAgICBpZihvUGFyZW50ID09IG51bGwpIHJldHVybjsKICAgICAgICAgICAgICAgIHZhciBvTm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpOwogICAgICAgICAgICAgICAgdmFyIGxldmVsID0gb1BhcmVudC5nZXRBdHRyaWJ1dGUoJ2xldmVsJykgKiAxOwogICAgICAgICAgICAgICAgdmFyIG5jaGlsZHMgPSBvUGFyZW50LmdldEF0dHJpYnV0ZSgnbmNoaWxkcycpICogMTsKICAgICAgICAgICAgICAgIG9QYXJlbnQuc2V0QXR0cmlidXRlKCduY2hpbGRzJywgbmNoaWxkcyArIDEpOwogICAgICAgICAgICAgICAgaWYocGlkID49IDApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHN0cmNoaWxkcyA9IG9QYXJlbnQuZ2V0QXR0cmlidXRlKCdjaGlsZHMnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgcE5hbWUgPSBvUGFyZW50LmdldEF0dHJpYnV0ZSgnVU5hbWUnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgY2hpbGRzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZihzdHJjaGlsZHMpIGNoaWxkcyA9IGV2YWwoc3RyY2hpbGRzKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGNoaWxkcyA9IG5ldyBBcnJheSgpOwogICAgICAgICAgICAgICAgICAgIGNoaWxkc1tpZF0gPSBuYW1lOwogICAgICAgICAgICAgICAgICAgIHN0cmNoaWxkcyA9ICIoeyI7CiAgICAgICAgICAgICAgICAgICAgZm9yKHggaW4gY2hpbGRzKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoeCAhPSBwaWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJjaGlsZHMgKz0geCsiOiciK2NoaWxkc1t4XSsiJywiOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBzdHJjaGlsZHMgKz0gcGlkKyI6JyIrcE5hbWUrIid9KSI7CiAgICAgICAgICAgICAgICAgICAgb1BhcmVudC5zZXRBdHRyaWJ1dGUoJ2NoaWxkcycsIHN0cmNoaWxkcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgb2ZvbGQgPSBudWxsOwogICAgICAgICAgICAgICAgaWYoKG9mb2xkID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2ZvbGRfJytwaWQpKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZihuY2hpbGRzID09IDApIG9mb2xkLmlubmVySFRNTCA9IGNocnRyZWU7IAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIG9uY2hpbGRzID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKChvbmNoaWxkcyA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdjaF8nK3BpZCkpKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIG9uY2hpbGRzLmlubmVySFRNTCA9IG5jaGlsZHMrMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG9Ob2RlLmlkID0gIm5vZGUiICsgaWQ7CiAgICAgICAgICAgICAgICBvTm9kZS5jbGFzc05hbWUgPSAnbm9kZSc7CiAgICAgICAgICAgICAgICBvTm9kZS5zZXRBdHRyaWJ1dGUoJ2xldmVsJywgbGV2ZWwgKyAxKTsKICAgICAgICAgICAgICAgIG9Ob2RlLnNldEF0dHJpYnV0ZSgnbmNoaWxkcycsIDApOwogICAgICAgICAgICAgICAgb05vZGUuc2V0QXR0cmlidXRlKCdwYXJlbnQnLCBwaWQpOwogICAgICAgICAgICAgICAgb05vZGUuc2V0QXR0cmlidXRlKCdVSUQnLCBpZCk7CiAgICAgICAgICAgICAgICBvTm9kZS5zZXRBdHRyaWJ1dGUoJ1VOYW1lJywgbmFtZSk7CiAgICAgICAgICAgICAgICBodG1sc3RyID0gIjxkaXYgaWQ9J3RpdGxlXyIrIGlkICsiJyBjbGFzcz0ndGl0bGUnICI7CiAgICAgICAgICAgICAgICBodG1sc3RyICs9ICIgb25tb3VzZW1vdmU9XCJvbkRpdih0aGlzLCAnYnRpdGxlJyk7XCIgIjsKICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiBvbm1vdXNlb3V0PVwib3V0RGl2KHRoaXMsICd0aXRsZScpO1wiPiI7CiAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0ndHJlZWxpbmUnPiI7CiAgICAgICAgICAgICAgICB2YXIgaSA9IDA7CiAgICAgICAgICAgICAgICBmb3IoaSA9IDA7IGkgPCAobGV2ZWwtMSk7IGkrKykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYobGV2ZWwgPiAwKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L3NwYW4+IjsKICAgICAgICAgICAgICAgIGlmKGNvdW50ID4gMCkKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBpZD0nZm9sZF8iKyBpZCArIicgY2xhc3M9J2ljb24nIG9uY2xpY2s9J0ZvbGQodGhpcyknPiIrY2hyYWRkKyI8L3NwYW4+IjsKICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBpZD0nZm9sZF8iKyBpZCArIicgY2xhc3M9J2ljb24nIG9uY2xpY2s9J0ZvbGQodGhpcyknPiIrY2hyZm9sZCsiPC9zcGFuPiI7CiAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gaWQ9J25kX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AgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC9kaXY+IjsKICAgICAgICAgICAgICAgIG9Ob2RlLmlubmVySFRNTCA9IGh0bWxzdHI7IAogICAgICAgICAgICAgICAgb1BhcmVudC5hcHBlbmRDaGlsZChvTm9kZSk7CiAgICAgICAgICAgICAgICByZXR1cm4gSGlkZGVuRWRpdG9yKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gVXBkYXRlTm9kZShpZCwgbmFtZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIG9Ob2RlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ25vZGUnK2lkKTsKICAgICAgICAgICAgICAgIGlmKG9Ob2RlICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgb05vZGUuc2V0QXR0cmlidXRlKCdVTmFtZScsIG5hbWUpOwogICAgICAgICAgICAgICAgICAgIHZhciBvTmFtZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCduZF8nK2lkKTsKICAgICAgICAgICAgICAgICAgICBpZihvTmFtZSAhPSBudWxsKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgb05hbWUuaW5uZXJIVE1MID0gbmFtZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gSGlkZGVuRWRpdG9yKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTGlzdENoaWxkcyhwYXJlbnQsIHVybCwgYXJndikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCk7CiAgICAgICAgICAgICAgICBpZih4bWxIdHRwICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgdXJsLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0bm9kZSA9IGV2YWwoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHRub2RlWydpZCddID09IHBhcmVudCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgdG5vZGVbJ25jaGlsZHMnXTsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBZGROb2RlKHBhcmVudCwgdG5vZGVbJ2NoaWxkcyddW2ldWydpZCddICogMSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bm9kZVsnY2hpbGRzJ11baV1bJ25hbWUnXSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bm9kZVsnY2hpbGRzJ11baV1bJ25jaGlsZHMnXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIEhpZGRlbkVkaXRvcigpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vY2xvc2UgZm9ybQogICAgICAgICAgICBmdW5jdGlvbiBDbG9zZVRoaXMoZWxlbWVudCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZWxlbWVudC5wYXJlbnROb2RlLnBhcmVudE5vZGUuc3R5bGUuZGlzcGxheSA9ICJub25lIjsKICAgICAgICAgICAgICAgIGhpZGVCRnJhbWUoZWxlbWVudC5wYXJlbnROb2RlLnBhcmVudE5vZGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vQWRkIGNoaWxkCiAgICAgICAgICAgIGZ1bmN0aW9uIFhBZGQoZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZSA9IGUgfHwgd2luZG93LmV2ZW50OwogICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBlLnRhcmdldCB8fCBlLnNyY0VsZW1lbnQ7CiAgICAgICAgICAgICAgICB2YXIgWGRpdiA9ICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgidHh0Zm9ybSIpOwogICAgICAgICAgICAgICAgdmFyIHggPSBlLmNsaWVudFggKyBkb2N1bWVudC5ib2R5LnNjcm9sbExlZnQ7CiAgICAgICAgICAgICAgICB2YXIgeSA9IGUuY2xpZW50WSArIGRvY3VtZW50LmJvZHkuc2Nyb2xsVG9wOwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS5sZWZ0ID0geDsKICAgICAgICAgICAgICAgIFhkaXYuc3R5bGUudG9wID0geSArIDEwOwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS5kaXNwbGF5ID0gJ2lubGluZSc7CiAgICAgICAgICAgICAgICBvdmVyQkZyYW1lKFhkaXYpOwogICAgICAgICAgICAgICAgdmFyIGZvcm0gPSBkb2N1bWVudC5mb3Jtc1siZWRpdG9yZm9ybSJdOwogICAgICAgICAgICAgICAgZm9ybVsnb3AnXS52YWx1ZSA9ICdub2RlX2FkZCc7CiAgICAgICAgICAgICAgICBmb3JtWydwaWQnXS52YWx1ZSA9IGVsZW1lbnQucGFyZW50Tm9kZS5wYXJlbnROb2RlLmdldEF0dHJpYnV0ZSgnVUlEJyk7CiAgICAgICAgICAgICAgICBmb3JtWydub2RlaWQnXS52YWx1ZSA9ICcnOwogICAgICAgICAgICAgICAgZm9ybVsnbm9kZW5hbWUnXS5mb2N1cygpOwogICAgICAgICAgICAgICAgZm9ybVsnbm9kZW5hbWUnXS52YWx1ZSA9ICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFhFZGl0KGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGUgPSBlIHx8IHdpbmRvdy5ldmVudDsKICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZS50YXJnZXQgfHwgZS5zcmNFbGVtZW50OwogICAgICAgICAgICAgICAgdmFyIFhkaXYgPSAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInR4dGZvcm0iKTsKICAgICAgICAgICAgICAgIHZhciB4ID0gZS5jbGllbnRYOwogICAgICAgICAgICAgICAgdmFyIHkgPSBlLmNsaWVudFk7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmxlZnQgPSB4OwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS50b3AgPSB5ICsgMTA7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgIG92ZXJCRnJhbWUoWGRpdik7CiAgICAgICAgICAgICAgICB2YXIgZm9ybSA9IGRvY3VtZW50LmZvcm1zWyJlZGl0b3Jmb3JtIl07CiAgICAgICAgICAgICAgICBmb3JtWydvcCddLnZhbHVlID0gJ25vZGVfdXBkYXRlJzsKICAgICAgICAgICAgICAgIGZvcm1bJ3BpZCddLnZhbHVlID0gZWxlbWVudC5wYXJlbnROb2RlLnBhcmVudE5vZGUuZ2V0QXR0cmlidXRlKCdwYXJlbnQnKTsKICAgICAgICAgICAgICAgIGZvcm1bJ25vZGVpZCddLnZhbHVlID0gZWxlbWVudC5wYXJlbnROb2RlLnBhcmVudE5vZGUuZ2V0QXR0cmlidXRlKCdVSUQnKTsKICAgICAgICAgICAgICAgIGZvcm1bJ25vZGVuYW1lJ10uZm9jdXMoKTsKICAgICAgICAgICAgICAgIGZvcm1bJ25vZGVuYW1lJ10udmFsdWUgPSBlbGVtZW50LnBhcmVudE5vZGUucGFyZW50Tm9kZS5nZXRBdHRyaWJ1dGUoJ1VOYW1lJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gSGlkZGVuRWRpdG9yKCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCd0eHRmb3JtJyk7CiAgICAgICAgICAgICAgICBkaXYuc3R5bGUuZGlzcGxheSA9ICdub25lJzsKICAgICAgICAgICAgICAgIGhpZGVCRnJhbWUoKTsKICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEVkaXROb2RlKGZvcm0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIiI7CiAgICAgICAgICAgICAgICB2YXIgb3AgPSBmb3JtWydvcCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIHBpZCA9IGZvcm1bJ3BpZCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIG5vZGVpZCA9IGZvcm1bJ25vZGVpZCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIG5vZGVuYW1lID0gZm9ybVsnbm9kZW5hbWUnXS52YWx1ZTsKICAgICAgICAgICAgICAgIGlmKG9wID09ICdub2RlX2FkZCcgJiYgbm9kZW5hbWUgJiYgcGlkID49IDApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgYXJndiA9ICJvcD0iK29wKyImbmFtZT0iK2VuY29kZVVSSUNvbXBvbmVudChub2RlbmFtZSkrIiZwYXJlbnRpZD0iK3BpZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYob3AgPT0gJ25vZGVfdXBkYXRlJyAmJiBub2RlbmFtZSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZihub2RlaWQgPiAwKQogICAgICAgICAgICAgICAgICAgIGFyZ3YgPSAib3A9IitvcCsiJm5hbWU9IitlbmNvZGVVUklDb21wb25lbnQobm9kZW5hbWUpCiAgICAgICAgICAgICAgICAgICAgICAgICsiJm5vZGVpZD0iK25vZGVpZCsiJnBhcmVudGlkPSIrcGlkOwogICAgICAgICAgICAgICAgICAgIGVsc2UgCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBVcGRhdGVOb2RlKG5vZGVpZCwgbm9kZW5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGlkZGVuRWRpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSByZXR1cm4gOwogICAgICAgICAgICAgICAgLy9hbGVydCgib3A6IitvcCsibm9kZWlkOiIrbm9kZWlkKyJwaWQ6IitwaWQrIm5vZGVuYW1lOiIrbm9kZW5hbWUpOwogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCk7CiAgICAgICAgICAgICAgICBpZih4bWxIdHRwICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG9wID09ICdub2RlX2FkZCcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdG5vZGUgPSBldmFsKHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYodG5vZGVbJ2lkJ10gPT0gcGlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IoaSA9IDA7IGkgPCB0bm9kZVsnbmNoaWxkcyddOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWRkTm9kZShwaWQsIHRub2RlWydjaGlsZHMnXVtpXVsnaWQnXSAqIDEsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG5vZGVbJ2NoaWxkcyddW2ldWyduYW1lJ10sIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG5vZGVbJ2NoaWxkcyddW2ldWyduY2hpbGRzJ10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYob3AgPT0gJ25vZGVfdXBkYXRlJykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpZCA9IHRyaW0oeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihpZCA+IDAgJiYgaWQgPT0gbm9kZWlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVXBkYXRlTm9kZShpZCwgbm9kZW5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBIaWRkZW5FZGl0b3IoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy9kZWxldGUgbm9kZQogICAgICAgICAgICBmdW5jdGlvbiBYRGVsZXRlKG5vZGVpZCwgcGFyZW50aWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBvTm9kZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJub2RlIitub2RlaWQpOwogICAgICAgICAgICAgICAgdmFyIG5hbWUgPSBudWxsOwogICAgICAgICAgICAgICAgaWYobm9kZWlkID4gMCAmJiBvTm9kZSAhPSBudWxsICYmIChuYW1lID0gb05vZGUuZ2V0QXR0cmlidXRlKCdVTmFtZScpKQogICAgICAgICAgICAgICAgICAgICYmIGNvbmZpcm0oJ0FyZSB5b3Ugc3VyZSBkZWxldGUgbm9kZTonK25vZGVpZCsnIG5hbWU6JytuYW1lKycgPycpIAogICAgICAgICAgICAgICAgICAgICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPW5vZGVfZGVsZXRlJm5vZGVpZD0iK25vZGVpZCsiJnBhcmVudGlkPSIrcGFyZW50aWQ7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpZCA9IHRyaW0oeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwaWQgPSBvTm9kZS5nZXRBdHRyaWJ1dGUoJ3BhcmVudCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvUGFyZW50ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ25vZGUnK3BpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoaWQgPT0gbm9kZWlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG5jaGlsZHMgPSBvUGFyZW50LmdldEF0dHJpYnV0ZSgnbmNoaWxkcycpIC0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb1BhcmVudC5zZXRBdHRyaWJ1dGUoJ25jaGlsZHMnLCBuY2hpbGRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQ2hpbGQob1BhcmVudCwgcGlkLCBpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvY2hpbGQgPSAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NoXycrcGlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2NoaWxkLmlubmVySFRNTCA9IG5jaGlsZHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9QYXJlbnQucmVtb3ZlQ2hpbGQob05vZGUpOyAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHVybGlkID0gZG9jdW1lbnQuZm9ybXNbJ3RlbXBsYXRlZm9ybSddWydub2RlaWQnXS52YWx1ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihpZCA9PSB1cmxpZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSGlkZGVuVGVtcGxhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBIaWRkZW5FZGl0b3IoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICAvL2ZvbGQgbm9kZQogICAgICAgICAgICBmdW5jdGlvbiBGb2xkKGVsZW1lbnQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBuY2hpbGRzID0gZWxlbWVudC5wYXJlbnROb2RlLnBhcmVudE5vZGUuZ2V0QXR0cmlidXRlKCduY2hpbGRzJykgKiAxOwogICAgICAgICAgICAgICAgdmFyIHVpZCA9IGVsZW1lbnQucGFyZW50Tm9kZS5wYXJlbnROb2RlLmdldEF0dHJpYnV0ZSgnVUlEJykgKiAxOwogICAgICAgICAgICAgICAgdmFyIHVybCA9ICIvIjsKICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPW5vZGVfY2hpbGRzJm5vZGVpZD0iK3VpZDsKICAgICAgICAgICAgICAgIGlmKGVsZW1lbnQuaW5uZXJIVE1MID09IGNocmFkZCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnBhcmVudE5vZGUucGFyZW50Tm9kZS5zdHlsZS5oZWlnaHQgPSAnJzsKICAgICAgICAgICAgICAgICAgICBMaXN0Q2hpbGRzKHVpZCwgdXJsLCBhcmd2KTsKICAgICAgICAgICAgICAgICAgICBpZihuY2hpbGRzID4gMCllbGVtZW50LmlubmVySFRNTCA9IGNocnRyZWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKGVsZW1lbnQuaW5uZXJIVE1MID09IGNocmZvbGQpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgTGlzdENoaWxkcyh1aWQsIHVybCwgYXJndik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5wYXJlbnROb2RlLnBhcmVudE5vZGUuc3R5bGUuaGVpZ2h0ID0gZWxlbWVudC5wYXJlbnROb2RlLm9mZnNldEhlaWdodDsKICAgICAgICAgICAgICAgICAgICBpZihuY2hpbGRzID4gMCkgZWxlbWVudC5pbm5lckhUTUwgPSBjaHJhZGQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gSGlkZGVuRWRpdG9yKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTGltaXRTcGVlZChmb3JtKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgc3BlZWQgPSBudWxsOwogICAgICAgICAgICAgICAgaWYoZm9ybSAmJiAoc3BlZWQgPSBmb3JtWydzcGVlZCddLnZhbHVlKSAhPSAnJwogICAgICAgICAgICAgICAgICAgICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXNwZWVkX2xpbWl0JnNwZWVkPSIrc3BlZWQ7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3dUYXNrSW5mbyh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIC8vU2hvdyBUYXNrCiAgICAgICAgICAgIGZ1bmN0aW9uIFNob3dUYXNrSW5mbyh0eHQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB0YXNraW5mbyA9IG51bGw7CiAgICAgICAgICAgICAgICBpZih0eHQgJiYgKHRhc2tpbmZvID0gZXZhbCh0eHQpKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgc3BlZWQgPSB0YXNraW5mb1snc3BlZWRfbGltaXQnXTsKICAgICAgICAgICAgICAgICAgICB2YXIgaHRtbHN0ciA9ICIiOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdrdGFzayc+54q25oCBOiZuYnNwOzwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxhIGhyZWY9XCJqYXZhc2NyaXB0OlZpZXdUYXNrKCd0YXNrXyI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSB0YXNraW5mb1snc3RhdHVzJ10rIicpO1wiIGNsYXNzPSd2dGFzayciOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIj4iK3Rhc2tpbmZvWydzdGF0dXMnXSsiPC9hPjxocj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdrdGFzayc+VVJM5oC75pWwOiZuYnNwOzwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSd2dGFzayc+Iit0YXNraW5mb1sndXJsX3RvdGFsJ107CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC9zcGFuPjxocj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdrdGFzayc+5Lu75Yqh5oC75pWwOiZuYnNwOzwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSd2dGFzayc+Iit0YXNraW5mb1sndXJsX250YXNrcyddOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjwvc3Bhbj48aHI+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0na3Rhc2snPuS7u+WKoeWujOaIkDombmJzcDs8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0ndnRhc2snPiIrdGFza2luZm9bJ3VybF90YXNrX29rJ107CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC9zcGFuPjxocj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdrdGFzayc+5Lu75Yqh6ZSZ6K+vOiZuYnNwOzwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSd2dGFzayc+Iit0YXNraW5mb1sndXJsX3Rhc2tfZXJyb3InXTsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L3NwYW4+PGhyPiI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J2t0YXNrJz7mlofmoaPlpKflsI86Jm5ic3A7PC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J3Z0YXNrJz4iK3Rhc2tpbmZvWydkb2NfdG90YWxfenNpemUnXTsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICIvIiArIHRhc2tpbmZvWydkb2NfdG90YWxfc2l6ZSddKyI8L3NwYW4+PGhyPiI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J2t0YXNrJz5ETlPop6PmnpA6Jm5ic3A7PC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J3Z0YXNrJz4iK3Rhc2tpbmZvWydob3N0X2N1cnJlbnQnXTsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICIvIiArIHRhc2tpbmZvWydob3N0X3RvdGFsJ10rIjwvc3Bhbj48aHI+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0na3Rhc2snPuW3sueUqOaXtumXtDombmJzcDs8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0ndnRhc2snPlsiK3Rhc2tpbmZvWyd0X2RheSddOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwO0RheShzKSZuYnNwOyZuYnNwOyIrdGFza2luZm9bJ3RfaG91ciddOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjoiK3Rhc2tpbmZvWyd0X21pbiddOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjoiK3Rhc2tpbmZvWyd0X3NlYyddOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOysiK3Rhc2tpbmZvWyd0X3VzZWMnXSsiXSI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC9zcGFuPjxocj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdrdGFzayc+5LiL6L296YCf5bqmOiZuYnNwOzwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSd2dGFzayc+Iit0YXNraW5mb1snc3BlZWQnXTsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICIgKEtCL1MpIDwvc3Bhbj48aHI+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0na3Rhc2snPumAn+W6pumZkOWItjombmJzcDs8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0ndnRhc2snPiI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPGZvcm0gYWN0aW9uPSdqYXZhc2NyaXB0OnZvaWQoMCknIGNsYXNzPSdsaXN0Zm9ybScgIjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICIgb25zdWJtaXQ9J0xpbWl0U3BlZWQodGhpcyknPiI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPGlucHV0IHR5cGU9dGV4dCBuYW1lPXNwZWVkIHZhbHVlPSciK3NwZWVkKyInPiAoS0IvUykgIjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDs8aW5wdXQgdHlwZT1zdWJtaXQgbmFtZT0nc3VibWl0JyB2YWx1ZT0nT0snPiI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAgIu+8iDDlkozotJ/mlbDooajnpLrkuI3pmZDpgJ/vvIk8L2Zvcm0+PC9zcGFuPjxocj4iOwogICAgICAgICAgICAgICAgICAgIHZhciBvdGFza2luZm8gPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGFza2luZm8nKTsKICAgICAgICAgICAgICAgICAgICBpZihvdGFza2luZm8pIAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgb3Rhc2tpbmZvLnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgICAgICAgICAgb3Rhc2tpbmZvLmlubmVySFRNTCA9IGh0bWxzdHI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICAvL3ZpZXcgVGFzawogICAgICAgICAgICBmdW5jdGlvbiBWaWV3VGFzayhvcCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOwogICAgICAgICAgICAgICAgaWYoKHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCkpICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFyZ3YgPSAib3A9IitvcDsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaG93VGFza0luZm8oeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNlbmQoYXJndik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gb25EaXYoZGl2LCBjc3NOYW1lKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBkaXYuY2xhc3NOYW1lID0gY3NzTmFtZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBvdXREaXYoZGl2LCBjc3NOYW1lKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBkaXYuY2xhc3NOYW1lID0gY3NzTmFtZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBSZXNldERCKCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIG9kYiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdkYnNlbGVjdCcpOwogICAgICAgICAgICAgICAgICAgIG9kYi5pbm5lckhUTUwgPSAiIjsKICAgICAgICAgICAgICAgIHZhciBvZGJmID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2RiZmllbGRzJyk7CiAgICAgICAgICAgICAgICAgICAgb2RiZi5pbm5lckhUTUwgPSAiIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBWaWV3REIodHh0KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgZGIgPSBldmFsKHR4dCk7CiAgICAgICAgICAgICAgICBpZihkYiAmJiBkYlsndGFibGVzJ10ubGVuZ3RoID4gMCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdGFiaWQgPSAwOwogICAgICAgICAgICAgICAgICAgIHZhciB0YWJuYW1lID0gIiI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGh0bWxzdHIgPSAiPHVsIGNsYXNzPSd1bHRhYic+IjsKICAgICAgICAgICAgICAgICAgICBmb3IoaSA9IDA7IGkgPCBkYlsndGFibGVzJ10ubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICB0YWJpZCA9IGRiWyd0YWJsZXMnXVtpXVsnaWQnXTsKICAgICAgICAgICAgICAgICAgICAgICAgdGFibmFtZSA9IGRiWyd0YWJsZXMnXVtpXVsnbmFtZSddOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8bGkgY2xhc3M9J2x0YWInIG9ubW91c2Vtb3ZlPVwib25EaXYodGhpcywgJ2x0YWItc2VsZWN0ZWQnKVwiICI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiBvbm1vdXNlb3V0PVwib3V0RGl2KHRoaXMsICdsdGFiJylcIiA+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J2x0YWJuYW1lJyBvbmNsaWNrPSdWaWV3VGFibGUoIit0YWJpZCsiKScgIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiIHRpdGxlPSfngrnlh7vov5vlhaXmlbDmja7ooajnrqHnkIYnID4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9IHRhYm5hbWUrIjwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0nZXVwZGF0ZScgdGl0bGU9J1JlbmFtZScgIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAib25jbGljaz1cIkRCWEVkaXQoZXZlbnQsIit0YWJpZCsiLCAnIit0YWJuYW1lKyInKVwiPiIrY2hyZWRpdCsiPC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdlZGVsZXRlJyB0aXRsZT0nRGVsZXRlJyAiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICJvbmNsaWNrPVwiRGVsZXRlVGFibGUoIit0YWJpZCsiLCAnIit0YWJuYW1lKyInKVwiPiIrY2hyZGVsKyI8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC9saT4iOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L3VsPiI7CiAgICAgICAgICAgICAgICAgICAgdmFyIG9kYiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdkYnNlbGVjdCcpOwogICAgICAgICAgICAgICAgICAgIG9kYi5pbm5lckhUTUwgPSBodG1sc3RyOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBBZGRUYWJsZShmb3JtKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgdGFibmFtZSA9IGZvcm1bJ3RhYm5hbWUnXS52YWx1ZTsKICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKHRhYm5hbWUgJiYgKHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCkpICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFyZ3YgPSAib3A9dGFibGVfYWRkJm5hbWU9Iit0YWJuYW1lOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3REIoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1bJ3RhYm5hbWUnXS52YWx1ZSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdEYXRhYmFzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgICAgICBSZXNldERCKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBEZWxldGVUYWJsZSh0YWJpZCwgdGFibmFtZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOwogICAgICAgICAgICAgICAgaWYoY29uZmlybSgiQXJlIHlvdSBzdXJlIGRlbGV0ZSB0YWJibGU6Iit0YWJuYW1lKyIgPyIpIAogICAgICAgICAgICAgICAgICAgICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXRhYmxlX2RlbGV0ZSZ0YWJsZWlkPSIrdGFiaWQ7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdEQih4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0RhdGFiYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgICAgIFJlc2V0REIoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vTGlzdCBUYWJsZSBGaWVsZHMKICAgICAgICAgICAgZnVuY3Rpb24gVmlld0ZpZWxkcyh0eHQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB0YWIgPSBldmFsKHR4dCk7CiAgICAgICAgICAgICAgICBpZih0YWIpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHRhYmlkID0gdGFiWydpZCddOwogICAgICAgICAgICAgICAgICAgIHZhciB0YWJuYW1lID0gdGFiWyduYW1lJ107CiAgICAgICAgICAgICAgICAgICAgdmFyIGZpZCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIGZuYW1lID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB2YXIgZnR5cGUgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHZhciBmbGFnID0gMDsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyID0gICI8dWwgY2xhc3M9J3VsdGFiJyA+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8bGkgY2xhc3M9J2ZpZWxkLXRpdGxlJz4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAi54K55Ye7PHNwYW4gY2xhc3M9J2VhZGQnIHRpdGxlPSdDbGljayBBZGQgTmV3IEZpZWxkJyAiOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIm9uY2xpY2s9XCJEQkZYQWRkKGV2ZW50LCAnIit0YWJpZCsiJylcIj4iK2NocmFkZCsiPC9zcGFuPua3u+WKoOWtl+autSI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0nbHRhYm5hbWUnPiIrdGFibmFtZSsiWyI7CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J25jaGlsZHMnPiIrdGFiWyduZmllbGRzJ10rIjwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIl08L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L2xpPiI7CiAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgdGFiWyduZmllbGRzJ107IGkrKykKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZpZCA9IHRhYlsnZmllbGRzJ11baV1bJ2lkJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGZuYW1lID0gdGFiWydmaWVsZHMnXVtpXVsnbmFtZSddOwogICAgICAgICAgICAgICAgICAgICAgICBmdHlwZSA9IHRhYlsnZmllbGRzJ11baV1bJ3R5cGUnXTsKICAgICAgICAgICAgICAgICAgICAgICAgZmxhZyA9IHRhYlsnZmllbGRzJ11baV1bJ2ZsYWcnXTsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPGxpIGNsYXNzPSdsZmllbGQnICI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiBvbm1vdXNlbW92ZT1cIm9uRGl2KHRoaXMsICdsZmllbGQtc2VsZWN0ZWQnKVwiICI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiBvbm1vdXNlb3V0PVwib3V0RGl2KHRoaXMsICdsZmllbGQnKTtcIiA+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J2xmbmFtZScgIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAib25jbGljaz1cIkRCRlhFZGl0KGV2ZW50LCAiK3RhYmlkKyIsIitmaWQrIiwiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICInIitmbmFtZSsiJywgIitmdHlwZSsiLCAiK2ZsYWcrIilcIj4iK2ZuYW1lKyI8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J2V1cGRhdGUnIHRpdGxlPSdDaGFuZ2UnICI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIm9uY2xpY2s9XCJEQkZYRWRpdChldmVudCwgIit0YWJpZCsiLCIrZmlkKyIsIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiJyIrZm5hbWUrIicsICIrZnR5cGUrIiwgIitmbGFnKyIpXCI+IitjaHJlZGl0KyI8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J2VkZWxldGUnIHRpdGxlPSdEZWxldGUnICI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIm9uY2xpY2s9XCJEZWxldGVGaWVsZCgiK3RhYmlkKyIsIitmaWQrIiwiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICInIit0YWJuYW1lKyInLCAnIitmbmFtZSsiJylcIj4iK2NocmRlbCsiPC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjwvbGk+IjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC91bD4iOwogICAgICAgICAgICAgICAgICAgIHZhciBvZGJmaWVsZHMgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZGJmaWVsZHMnKTsKICAgICAgICAgICAgICAgICAgICBvZGJmaWVsZHMuaW5uZXJIVE1MID0gaHRtbHN0cjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICAvL0xpc3QvVmlldyBGaWVsZAogICAgICAgICAgICBmdW5jdGlvbiBWaWV3VGFibGUodGFiaWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKCiAgICAgICAgICAgICAgICBpZih0YWJpZCA+PSAwICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXRhYmxlX3ZpZXcmdGFibGVpZD0iK3RhYmlkOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3RmllbGRzKHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNlbmQoYXJndik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgIC8vVmlldyBkYXRhYmFzZQogICAgICAgICAgICBmdW5jdGlvbiBWaWV3RGF0YWJhc2UoKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7CiAgICAgICAgICAgICAgICBpZigoeG1sSHR0cCA9IENyZWF0ZVhNTEhUVFAoKSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYXJndiA9ICJvcD1kYXRhYmFzZV92aWV3IjsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9wZW4oJ1BPU1QnLCAnLycsIHRydWUpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1MZW5ndGgiLCBhcmd2Lmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LVR5cGUiLCAiYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkIik7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vbnJlYWR5c3RhdGVjaGFuZ2U9ZnVuY3Rpb24oKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5yZWFkeVN0YXRlPT00KQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnN0YXR1cyA9PSAyMDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG9kYiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdkYXRhYmFzZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9kYi5zZXRBdHRyaWJ1dGUoJ2RiYXNlJywgeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvYWRMaW5rT3B0aW9ucygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vTGlzdCBUYWJsZXMKICAgICAgICAgICAgZnVuY3Rpb24gTGlzdFRhYmxlcygpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKCh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXRhYmxlX2xpc3QiOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3REIoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBIaWRkZW5EQmZvcm0oKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2RiZm9ybScpOwogICAgICAgICAgICAgICAgZGl2LnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICBoaWRlQkZyYW1lKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBEQlhBZGQoZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZSA9IGUgfHwgd2luZG93LmV2ZW50OwogICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBlLnRhcmdldCB8fCBlLnNyY0VsZW1lbnQ7CiAgICAgICAgICAgICAgICB2YXIgeCA9IGUuY2xpZW50WCArIGRvY3VtZW50LmJvZHkuc2Nyb2xsTGVmdDsKICAgICAgICAgICAgICAgIHZhciB5ID0gZS5jbGllbnRZICsgZG9jdW1lbnQuYm9keS5zY3JvbGxUb3A7CiAgICAgICAgICAgICAgICB2YXIgWGRpdiA9ICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiZGJmb3JtIik7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmxlZnQgPSB4OwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS50b3AgPSB5ICsgMTA7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgIG92ZXJCRnJhbWUoWGRpdik7CiAgICAgICAgICAgICAgICB2YXIgZm9ybSA9IGRvY3VtZW50LmZvcm1zWyJ4ZGJmb3JtIl07CiAgICAgICAgICAgICAgICBmb3JtWydvcCddLnZhbHVlID0gJ3RhYmxlX2FkZCc7CiAgICAgICAgICAgICAgICBmb3JtWyd0YWJsZWlkJ10udmFsdWUgPSAnJzsKICAgICAgICAgICAgICAgIGZvcm1bJ25hbWUnXS5mb2N1cygpOwogICAgICAgICAgICAgICAgZm9ybVsnbmFtZSddLnZhbHVlID0gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gREJYRWRpdChlLCBpZCwgbmFtZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZSA9IGUgfHwgd2luZG93LmV2ZW50OwogICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBlLnRhcmdldCB8fCBlLnNyY0VsZW1lbnQ7CiAgICAgICAgICAgICAgICB2YXIgWGRpdiA9ICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiZGJmb3JtIik7CiAgICAgICAgICAgICAgICB2YXIgeCA9IGUuY2xpZW50WCArIGRvY3VtZW50LmJvZHkuc2Nyb2xsTGVmdDsKICAgICAgICAgICAgICAgIHZhciB5ID0gZS5jbGllbnRZICsgZG9jdW1lbnQuYm9keS5zY3JvbGxUb3A7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmxlZnQgPSB4OwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS50b3AgPSB5ICsgMTA7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgIG92ZXJCRnJhbWUoWGRpdik7CiAgICAgICAgICAgICAgICB2YXIgZm9ybSA9IGRvY3VtZW50LmZvcm1zWyJ4ZGJmb3JtIl07CiAgICAgICAgICAgICAgICBmb3JtWydvcCddLnZhbHVlID0gJ3RhYmxlX3JlbmFtZSc7CiAgICAgICAgICAgICAgICBmb3JtWyd0YWJsZWlkJ10udmFsdWUgPSBpZDsKICAgICAgICAgICAgICAgIGZvcm1bJ25hbWUnXS5mb2N1cygpOwogICAgICAgICAgICAgICAgZm9ybVsnbmFtZSddLnZhbHVlID0gbmFtZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBFZGl0REIoZm9ybSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYoZm9ybSA9PSBudWxsKSByZXR1cm47CiAgICAgICAgICAgICAgICB2YXIgYXJndiA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgb3AgPSBmb3JtWydvcCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIHRhYmxlaWQgPSBmb3JtWyd0YWJsZWlkJ10udmFsdWU7CiAgICAgICAgICAgICAgICB2YXIgbmFtZSA9IGZvcm1bJ25hbWUnXS52YWx1ZTsKICAgICAgICAgICAgICAgIGlmKG9wID09ICd0YWJsZV9hZGQnICYmIG5hbWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgYXJndiA9ICJvcD10YWJsZV9hZGQmbmFtZT0iK25hbWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKG9wID09ICd0YWJsZV9yZW5hbWUnICYmIHRhYmxlaWQgPj0gMCAmJiBuYW1lKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGFyZ3YgPSAib3A9dGFibGVfcmVuYW1lJnRhYmxlaWQ9Iit0YWJsZWlkKyImbmFtZT0iK25hbWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKG9wID09ICd0YWJsZV9kZWxldGUnICYmIHRhYmxlaWQgPj0gMCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBhcmd2ID0gIm9wPXRhYmxlX2RlbGV0ZSZ0YWJsZWlkPSIrdGFibGVpZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKGFyZ3YgJiYgKHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCkpICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdEQih4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIEhpZGRlbkRCZm9ybSgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIERCRlhBZGQoZSwgdGFiaWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGUgPSBlIHx8IHdpbmRvdy5ldmVudDsKICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZS50YXJnZXQgfHwgZS5zcmNFbGVtZW50OwogICAgICAgICAgICAgICAgdmFyIFhkaXYgPSAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImRiZmllbGRmb3JtIik7CiAgICAgICAgICAgICAgICB2YXIgeCA9IGUuY2xpZW50WCArIGRvY3VtZW50LmJvZHkuc2Nyb2xsTGVmdDsKICAgICAgICAgICAgICAgIHZhciB5ID0gZS5jbGllbnRZICsgZG9jdW1lbnQuYm9keS5zY3JvbGxUb3A7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmxlZnQgPSB4OwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS50b3AgPSB5ICsgMTA7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgIG92ZXJCRnJhbWUoWGRpdik7CiAgICAgICAgICAgICAgICB2YXIgZm9ybSA9IGRvY3VtZW50LmZvcm1zWyJkYmZpZWxkZm9ybSJdOwogICAgICAgICAgICAgICAgZm9ybVsnb3AnXS52YWx1ZSA9ICdmaWVsZF9hZGQnOwogICAgICAgICAgICAgICAgZm9ybVsndGFibGVpZCddLnZhbHVlID0gdGFiaWQ7CiAgICAgICAgICAgICAgICBmb3JtWydmaWVsZGlkJ10udmFsdWUgPSAnJzsKICAgICAgICAgICAgICAgIGZvcm1bJ29sZG5hbWUnXS52YWx1ZSA9ICcnOwogICAgICAgICAgICAgICAgZm9ybVsndHlwZSddLnZhbHVlID0gJyc7CiAgICAgICAgICAgICAgICBmb3JtWydmbGFnJ10udmFsdWUgPSAnJzsKICAgICAgICAgICAgICAgIGZvcm1bJ2lzX2luZGV4J10uY2hlY2tlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgZm9ybVsnaXNfbnVsbCddLmNoZWNrZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGZvcm1bJ25hbWUnXS5mb2N1cygpOwogICAgICAgICAgICAgICAgZm9ybVsnbmFtZSddLnZhbHVlID0gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gREJGWEVkaXQoZSwgdGFiaWQsIGZpZWxkaWQsIGZuYW1lLCBmdHlwZSwgZmxhZykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZSA9IGUgfHwgd2luZG93LmV2ZW50OwogICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBlLnRhcmdldCB8fCBlLnNyY0VsZW1lbnQ7CiAgICAgICAgICAgICAgICB2YXIgWGRpdiA9ICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiZGJmaWVsZGZvcm0iKTsKICAgICAgICAgICAgICAgIHZhciB4ID0gZS5jbGllbnRYICsgZG9jdW1lbnQuYm9keS5zY3JvbGxMZWZ0OwogICAgICAgICAgICAgICAgdmFyIHkgPSBlLmNsaWVudFkgKyBkb2N1bWVudC5ib2R5LnNjcm9sbFRvcDsKICAgICAgICAgICAgICAgIFhkaXYuc3R5bGUubGVmdCA9IHg7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLnRvcCA9IHkgKyAxMDsKICAgICAgICAgICAgICAgIFhkaXYuc3R5bGUuZGlzcGxheSA9ICdpbmxpbmUnOwogICAgICAgICAgICAgICAgb3ZlckJGcmFtZShYZGl2KTsKICAgICAgICAgICAgICAgIHZhciBmb3JtID0gZG9jdW1lbnQuZm9ybXNbImRiZmllbGRmb3JtIl07CiAgICAgICAgICAgICAgICBmb3JtWydvcCddLnZhbHVlID0gJ2ZpZWxkX3VwZGF0ZSc7CiAgICAgICAgICAgICAgICBmb3JtWyd0YWJsZWlkJ10udmFsdWUgPSB0YWJpZDsKICAgICAgICAgICAgICAgIGZvcm1bJ2ZpZWxkaWQnXS52YWx1ZSA9IGZpZWxkaWQ7CiAgICAgICAgICAgICAgICBmb3JtWydvbGRuYW1lJ10udmFsdWUgPSBmbmFtZTsKICAgICAgICAgICAgICAgIGZvcm1bJ3R5cGUnXS52YWx1ZSA9IGZ0eXBlOwogICAgICAgICAgICAgICAgZm9ybVsnZmxhZyddLnZhbHVlID0gZmxhZzsKICAgICAgICAgICAgICAgIGZvcm1bJ2lzX2luZGV4J10uY2hlY2tlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgZm9ybVsnaXNfbnVsbCddLmNoZWNrZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGZvcihpID0gMDsgaSA8IGZvcm1bJ2Z0eXBlJ10ub3B0aW9ucy5sZW5ndGg7IGkrKykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZihmb3JtWydmdHlwZSddLm9wdGlvbnNbaV0udmFsdWUgPT0gZnR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1bJ2Z0eXBlJ10ub3B0aW9uc1tpXS5zZWxlY3RlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgZWxzZSAKICAgICAgICAgICAgICAgICAgICAgICAgZm9ybVsnZnR5cGUnXS5vcHRpb25zW2ldLnNlbGVjdGVkID0gZmFsc2U7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZihmbGFnICYgMSkgZm9ybVsnaXNfaW5kZXgnXS5jaGVja2VkID0gdHJ1ZTsKICAgICAgICAgICAgICAgIGlmKGZsYWcgJiAyKSBmb3JtWydpc19udWxsJ10uY2hlY2tlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBmb3JtWyduYW1lJ10uZm9jdXMoKTsKICAgICAgICAgICAgICAgIGZvcm1bJ25hbWUnXS52YWx1ZSA9IGZuYW1lOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEhpZGRlbkRCRmllbGRmb3JtKCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdkYmZpZWxkZm9ybScpOwogICAgICAgICAgICAgICAgZGl2LnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICBoaWRlQkZyYW1lKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBFZGl0RmllbGQoZm9ybSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYoZm9ybSA9PSBudWxsKSByZXR1cm47CiAgICAgICAgICAgICAgICB2YXIgYXJndiA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgb3AgPSBmb3JtWydvcCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIHRhYmxlaWQgPSBmb3JtWyd0YWJsZWlkJ10udmFsdWU7CiAgICAgICAgICAgICAgICB2YXIgZmllbGRpZCA9IGZvcm1bJ2ZpZWxkaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgIHZhciBmbmFtZSA9IGZvcm1bJ25hbWUnXS52YWx1ZTsKICAgICAgICAgICAgICAgIHZhciBmdHlwZSA9IGZvcm1bJ2Z0eXBlJ10udmFsdWU7CiAgICAgICAgICAgICAgICB2YXIgb2xkbmFtZSA9IGZvcm1bJ29sZG5hbWUnXS52YWx1ZTsKICAgICAgICAgICAgICAgIHZhciBvbGR0eXBlID0gZm9ybVsndHlwZSddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIG9sZGZsYWcgPSBmb3JtWydmbGFnJ10udmFsdWU7CiAgICAgICAgICAgICAgICB2YXIgZmxhZyA9IDA7CiAgICAgICAgICAgICAgICBpZihvcCA9PSAnZmllbGRfYWRkJyAmJiB0YWJsZWlkID49IDAgJiYgZm5hbWUgJiYgZnR5cGUgPiAwKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGFyZ3YgPSAib3A9ZmllbGRfYWRkJnRhYmxlaWQ9Iit0YWJsZWlkKyImbmFtZT0iK2ZuYW1lKyImdHlwZT0iK2Z0eXBlOwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX2luZGV4J10uY2hlY2tlZCA9PSB0cnVlKSBmbGFnIHw9IDE7CiAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnaXNfbnVsbCddLmNoZWNrZWQgPT0gdHJ1ZSkgZmxhZyB8PSAyOwogICAgICAgICAgICAgICAgICAgIGlmKGZsYWcgPiAwKSBhcmd2ICs9ICImZmxhZz0iK2ZsYWc7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKG9wID09ICdmaWVsZF91cGRhdGUnICYmIHRhYmxlaWQgPj0gMCAmJiBmaWVsZGlkID49IDApIAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBlYXJndiA9ICIiOwogICAgICAgICAgICAgICAgICAgIGlmKGZuYW1lICYmIGZuYW1lICE9IG9sZG5hbWUpIGVhcmd2ICs9ICImbmFtZT0iK2ZuYW1lOwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX2luZGV4J10uY2hlY2tlZCA9PSB0cnVlKSBmbGFnIHw9IDE7CiAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnaXNfbnVsbCddLmNoZWNrZWQgPT0gdHJ1ZSkgZmxhZyB8PSAyOwogICAgICAgICAgICAgICAgICAgIGlmKGZ0eXBlICE9IG9sZHR5cGUpIGVhcmd2ICs9ICImdHlwZT0iK2Z0eXBlOwogICAgICAgICAgICAgICAgICAgIGlmKGZsYWcgIT0gb2xkZmxhZykgZWFyZ3YgKz0gIiZmbGFnPSIrZmxhZzsKICAgICAgICAgICAgICAgICAgICBpZihlYXJndikKICAgICAgICAgICAgICAgICAgICAgICAgYXJndiA9ICJvcD1maWVsZF91cGRhdGUmdGFibGVpZD0iK3RhYmxlaWQrIiZmaWVsZGlkPSIrZmllbGRpZCtlYXJndjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKGFyZ3YgJiYgKHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCkpICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdGaWVsZHMoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdEYXRhYmFzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBIaWRkZW5EQkZpZWxkZm9ybSgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIERlbGV0ZUZpZWxkKHRhYmlkLCBmaWVsZGlkLCB0YWJuYW1lLCBmaWVsZG5hbWUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmKGNvbmZpcm0oIkFyZSB5b3Ugc3VyZSBkZWxldGUgVGFibGU6Iit0YWJuYW1lKyIgRmllbGQ6IitmaWVsZG5hbWUrIj8iKSAKICAgICAgICAgICAgICAgICAgICAmJiAoeG1sSHR0cCA9IENyZWF0ZVhNTEhUVFAoKSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYXJndiA9ICJvcD1maWVsZF9kZWxldGUmdGFibGVpZD0iK3RhYmlkKyImZmllbGRpZD0iK2ZpZWxkaWQ7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdGaWVsZHMoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdEYXRhYmFzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vZGVsZXRlIGRpdgogICAgICAgICAgICBmdW5jdGlvbiBkaXZyZW1vdmUoZWxlbWVudCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZChlbGVtZW50KTsKICAgICAgICAgICAgICAgIGhpZGVCRnJhbWUoKTsKICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGRpdmhpZGRlbihlbGVtZW50KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZihlbGVtZW50ICYmIGVsZW1lbnQuaW5uZXJIVE1MKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuaW5uZXJIVE1MID0gIiI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBoaWRlQkZyYW1lKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgCiAgICAgICAgICAgIC8vbW92aW5nIGRpdgogICAgICAgICAgICBmdW5jdGlvbiBkaXZtb3ZlKGUsIG8pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIG8ub25zZWxlY3RzdGFydCA9IGZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4oZmFsc2UpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIG8ub25tb3VzZWRvd24gPSBmdW5jdGlvbihlKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGUgPSBlfHx3aW5kb3cuZXZlbnQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIHggPSBwYXJzZUludChlLmNsaWVudFggLSBvLnBhcmVudE5vZGUub2Zmc2V0TGVmdCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSBwYXJzZUludChlLmNsaWVudFkgLSBvLnBhcmVudE5vZGUub2Zmc2V0VG9wKTsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5vbm1vdXNlbW92ZSA9IGZ1bmN0aW9uKGUpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBlPWV8fHdpbmRvdy5ldmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgby5wYXJlbnROb2RlLnN0eWxlLmxlZnQ9KGUuY2xpZW50WC14KSsicHgiOwogICAgICAgICAgICAgICAgICAgICAgICBvLnBhcmVudE5vZGUuc3R5bGUudG9wPShlLmNsaWVudFkteSkrInB4IjsKICAgICAgICAgICAgICAgICAgICAgICAgb3ZlckJGcmFtZShvLnBhcmVudE5vZGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQub25tb3VzZXVwPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50Lm9ubW91c2Vtb3ZlPW51bGw7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGZ1bmN0aW9uIFJlc2V0VGVtcGxhdGVmb3JtKCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGZvcm0gPSBkb2N1bWVudC5mb3Jtc1sidGVtcGxhdGVmb3JtIl07CiAgICAgICAgICAgICAgICBmb3JtWydvcCddLnZhbHVlID0gJ3RlbXBsYXRlX2FkZCc7CiAgICAgICAgICAgICAgICBmb3JtWyd0ZW1wbGF0ZWlkJ10udmFsdWUgPSAtMTsKICAgICAgICAgICAgICAgIGZvcm1bJ3BhdHRlcm4nXS52YWx1ZSA9ICcnCiAgICAgICAgICAgICAgICBmb3JtWydpc19wdWJsaWMnXS5jaGVja2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICBmb3JtWydpc19nbG9iYWwnXS5jaGVja2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICBmb3JtWydpc19pZ25vcmVjYXNlJ10uY2hlY2tlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgZm9ybVsnZmxhZyddLnZhbHVlID0gJyc7CiAgICAgICAgICAgICAgICBmb3JtWyduZmllbGRzJ10udmFsdWUgPSAwOwogICAgICAgICAgICAgICAgZm9ybVsnbGluayddLnZhbHVlID0gJyc7CiAgICAgICAgICAgICAgICBmb3JtWydsaW5rbWFwJ10udmFsdWUgPSAnJzsKICAgICAgICAgICAgICAgIGZvcm1bJ21hcCddLnZhbHVlID0gJyc7CiAgICAgICAgICAgICAgICBmb3JtWydsaW5rX21ldGhvZCddWzBdLmNoZWNrZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgZm9ybVsnbGlua19saXN0J10uY2hlY2tlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgZm9ybVsnbGlua190YWJsZSddLm9wdGlvbnNbMF0uc2VsZWN0ZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgZm9ybVsnbGlua19maWVsZCddLm9wdGlvbnNbMF0uc2VsZWN0ZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgZm9ybVsnbGlua19ub2RlJ10ub3B0aW9uc1swXS5zZWxlY3RlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gWFRSZXNldCgpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBvZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3NvdXJjZV92aWV3Jyk7CiAgICAgICAgICAgICAgICBpZihvZGl2KSBvZGl2LmlubmVySFRNTCA9ICIiOwogICAgICAgICAgICAgICAgdmFyIGZvcm0gPSBkb2N1bWVudC5mb3Jtc1sidGVtcGxhdGVmb3JtIl07CiAgICAgICAgICAgICAgICBmb3JtWydvcCddLnZhbHVlID0gJ3RlbXBsYXRlX2FkZCc7CiAgICAgICAgICAgICAgICBmb3JtWydub2RlaWQnXS52YWx1ZSA9IC0xOwogICAgICAgICAgICAgICAgZm9ybVsndGVtcGxhdGVpZCddLnZhbHVlID0gLTE7CiAgICAgICAgICAgICAgICBmb3JtWydjb2RlJ10udmFsdWUgPSAnJzsKICAgICAgICAgICAgICAgIGZvcm1bJ3BhdHRlcm4nXS52YWx1ZSA9ICcnCiAgICAgICAgICAgICAgICBmb3JtWydpc19wdWJsaWMnXS5jaGVja2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICBmb3JtWydpc19nbG9iYWwnXS5jaGVja2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICBmb3JtWydpc19pZ25vcmVjYXNlJ10uY2hlY2tlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgZm9ybVsnZmxhZyddLnZhbHVlID0gJyc7CiAgICAgICAgICAgICAgICBmb3JtWyduZmllbGRzJ10udmFsdWUgPSAwOwogICAgICAgICAgICAgICAgZm9ybVsndXJsJ10udmFsdWUgPSAnJzsKICAgICAgICAgICAgICAgIGZvcm1bJ2xpbmsnXS52YWx1ZSA9ICcnOwogICAgICAgICAgICAgICAgZm9ybVsnbGlua21hcCddLnZhbHVlID0gJyc7CiAgICAgICAgICAgICAgICBmb3JtWydtYXAnXS52YWx1ZSA9ICcnOwogICAgICAgICAgICAgICAgZm9ybVsnbWV0aG9kJ10udmFsdWUgPSAwOwogICAgICAgICAgICAgICAgZm9ybVsnbGlua19tZXRob2QnXVswXS5jaGVja2VkID0gdHJ1ZTsKICAgICAgICAgICAgICAgIGZvcm1bJ2xpbmtfbGlzdCddLmNoZWNrZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGZvcm1bJ2xpbmtfdGFibGUnXS5vcHRpb25zLmxlbmd0aCA9IDE7CiAgICAgICAgICAgICAgICBmb3JtWydsaW5rX2ZpZWxkJ10ub3B0aW9ucy5sZW5ndGggPSAxOwogICAgICAgICAgICAgICAgZm9ybVsnbGlua19ub2RlJ10ub3B0aW9ucy5sZW5ndGggPSAxOwogICAgICAgICAgICAgICAgZm9ybSA9IGRvY3VtZW50LmZvcm1zWyd1cmxmb3JtJ107CiAgICAgICAgICAgICAgICBmb3JtWydtZXRob2QnXVswXS5jaGVja2VkID0gdHJ1ZTsKICAgICAgICAgICAgICAgIGhpZGVCRnJhbWUoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBYVEFkZChub2RlaWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBYZGl2ID0gIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJ4dGVtcGxhdGVmb3JtIik7CiAgICAgICAgICAgICAgICBYZGl2LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgIFhUUmVzZXQoKTsKICAgICAgICAgICAgICAgIHZhciB4Zm9ybSA9IGRvY3VtZW50LmZvcm1zWyJ0ZW1wbGF0ZWZvcm0iXTsKICAgICAgICAgICAgICAgIHhmb3JtWydub2RlaWQnXS52YWx1ZSA9IG5vZGVpZDsKICAgICAgICAgICAgICAgIHZhciB1cmxmb3JtID0gZG9jdW1lbnQuZm9ybXNbInVybGZvcm0iXTsKICAgICAgICAgICAgICAgIHVybGZvcm1bJ21ldGhvZCddWzBdLmNoZWNrZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgdXJsZm9ybVsndXJsJ10uZm9jdXMoKTsKICAgICAgICAgICAgICAgIHVybGZvcm1bJ3VybCddLnZhbHVlID0gJ2h0dHA6Ly8nOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFhURWRpdChmb3JtaWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFhUUmVzZXQoKTsKICAgICAgICAgICAgICAgIHZhciB4Zm9ybSA9IGRvY3VtZW50LmZvcm1zWyJ0ZW1wbGF0ZWZvcm0iXTsKICAgICAgICAgICAgICAgIHZhciBmb3JtID0gZG9jdW1lbnQuZm9ybXNbZm9ybWlkXTsKICAgICAgICAgICAgICAgIHhmb3JtWydvcCddLnZhbHVlID0gJ3RlbXBsYXRlX3VwZGF0ZSc7CiAgICAgICAgICAgICAgICB4Zm9ybVsnbm9kZWlkJ10udmFsdWUgPSBmb3JtWydub2RlaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgIHhmb3JtWyd0YWJsZWlkJ10udmFsdWUgPSBmb3JtWyd0YWJsZWlkJ10udmFsdWU7CiAgICAgICAgICAgICAgICB4Zm9ybVsndGVtcGxhdGVpZCddLnZhbHVlID0gZm9ybVsndGVtcGxhdGVpZCddLnZhbHVlOwogICAgICAgICAgICAgICAgeGZvcm1bJ3BhdHRlcm4nXS52YWx1ZSA9IGZvcm1bJ3BhdHRlcm4nXS52YWx1ZTsKICAgICAgICAgICAgICAgIHhmb3JtWydmbGFnJ10udmFsdWUgPSBmb3JtWydmbGFnJ10udmFsdWU7CiAgICAgICAgICAgICAgICB4Zm9ybVsnbmZpZWxkcyddLnZhbHVlID0gZm9ybVsnbmZpZWxkcyddLnZhbHVlOwogICAgICAgICAgICAgICAgeGZvcm1bJ3VybCddLnZhbHVlID0gZm9ybVsndXJsJ10udmFsdWU7CiAgICAgICAgICAgICAgICB4Zm9ybVsnbGluayddLnZhbHVlID0gZm9ybVsnbGluayddLnZhbHVlOwogICAgICAgICAgICAgICAgeGZvcm1bJ2xpbmttYXAnXS52YWx1ZSA9IGZvcm1bJ2xpbmttYXAnXS52YWx1ZTsKICAgICAgICAgICAgICAgIHhmb3JtWydtYXAnXS52YWx1ZSA9IGZvcm1bJ21hcCddLnZhbHVlOwogICAgICAgICAgICAgICAgaWYoeGZvcm1bJ2ZsYWcnXS52YWx1ZSAmIDEpCiAgICAgICAgICAgICAgICAgICAgeGZvcm1bJ2lzX3B1YmxpYyddLmNoZWNrZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgaWYoeGZvcm1bJ2ZsYWcnXS52YWx1ZSAmIDIpCiAgICAgICAgICAgICAgICAgICAgeGZvcm1bJ2lzX2dsb2JhbCddLmNoZWNrZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgaWYoeGZvcm1bJ2ZsYWcnXS52YWx1ZSAmIDQpCiAgICAgICAgICAgICAgICAgICAgeGZvcm1bJ2lzX2lnbm9yZWNhc2UnXS5jaGVja2VkID0gdHJ1ZTsKICAgICAgICAgICAgICAgIHhmb3JtWydtZXRob2QnXS52YWx1ZSA9IDA7CiAgICAgICAgICAgICAgICBpZihmb3JtWydtZXRob2QnXS52YWx1ZSA9PSAxKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHhmb3JtWydtZXRob2QnXS52YWx1ZSA9IDE7CiAgICAgICAgICAgICAgICAgICAgeGZvcm1bJ2ZsYWcnXS52YWx1ZSB8PSAxNjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBzdHJsaW5rbWFwID0gZm9ybVsnbGlua21hcCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIGxpbmttYXAgPSBudWxsOwogICAgICAgICAgICAgICAgaWYoc3RybGlua21hcCAmJiAobGlua21hcCA9IGV2YWwoc3RybGlua21hcCkpKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlmKGxpbmttYXBbJ2ZsYWcnXSAmIDE2KQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgeGZvcm1bJ2xpbmtfbWV0aG9kJ11bMV0uY2hlY2tlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmKGxpbmttYXBbJ2ZsYWcnXSAmIDY0KQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgeGZvcm1bJ2xpbmtfbGlzdCddLmNoZWNrZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBlZGl2ID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKChlZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3h0ZW1wbGF0ZWZvcm0nKSkpIAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGVkaXYuc3R5bGUuZGlzcGxheSA9ICJpbmxpbmUiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYoKGVkaXYgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGVtcGxhdGVkaXYnKSkpIAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGVkaXYuc3R5bGUuZGlzcGxheSA9ICJpbmxpbmUiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHVybGZvcm0gPSBkb2N1bWVudC5mb3Jtc1sidXJsZm9ybSJdOwogICAgICAgICAgICAgICAgdXJsZm9ybVsnbWV0aG9kJ11bMF0uY2hlY2tlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBpZihmb3JtWydmbGFnJ10udmFsdWUgJiAxNikKICAgICAgICAgICAgICAgICAgICB1cmxmb3JtWydtZXRob2QnXVsxXS5jaGVja2VkID0gdHJ1ZTsKICAgICAgICAgICAgICAgIHVybGZvcm1bJ3VybCddLmZvY3VzKCk7CiAgICAgICAgICAgICAgICBpZihmb3JtWyd1cmwnXS52YWx1ZSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB1cmxmb3JtWyd1cmwnXS52YWx1ZSA9IGZvcm1bJ3VybCddLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIExvYWRVUkwodXJsZm9ybSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gWFREZWxldGUobm9kZWlkLCB0ZW1wbGF0ZWlkKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgbXNnID0gIkFyZSB5b3Ugc3VyZSBkZWxldGUgdGVtcGxhdGVbIit0ZW1wbGF0ZWlkKyJdIGZyb20gbm9kZVsiK25vZGVpZCsiXSA/IjsKICAgICAgICAgICAgICAgIGlmKGNvbmZpcm0obXNnKSAmJiAoeG1sSHR0cCA9IENyZWF0ZVhNTEhUVFAoKSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYXJndiA9ICJvcD10ZW1wbGF0ZV9kZWxldGUmbm9kZWlkPSIrbm9kZWlkKyImdGVtcGxhdGVpZD0iK3RlbXBsYXRlaWQ7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vSGlkZGVuVGVtcGxhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaG93VGVtcGxhdGVzKHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNlbmQoYXJndik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBIaWRkZW5UZW1wbGF0ZSgpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBkaXYgPSBudWxsOwogICAgICAgICAgICAgICAgaWYoKGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCd0ZW1wbGF0ZS1jb25maWcnKSkpCiAgICAgICAgICAgICAgICAgICAgZGl2LmlubmVySFRNTCA9ICIiOwogICAgICAgICAgICAgICAgaWYoKGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdub2RlLXRlbXBsYXRlJykpKQogICAgICAgICAgICAgICAgICAgIGRpdi5pbm5lckhUTUwgPSAiIjsKICAgICAgICAgICAgICAgIGlmKChkaXYgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnc291cmNlX3ZpZXcnKSkpCiAgICAgICAgICAgICAgICAgICAgZGl2LmlubmVySFRNTCA9ICIiOwogICAgICAgICAgICAgICAgaWYoKGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzb3VyY2VfY29kZV9vcCcpKSkKICAgICAgICAgICAgICAgICAgICBkaXYuc3R5bGUuZGlzcGxheSA9ICdub25lJzsKICAgICAgICAgICAgICAgIGlmKChkaXYgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGVtcGxhdGVkaXYnKSkpCiAgICAgICAgICAgICAgICAgICAgZGl2LnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICBpZigoZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3h0ZW1wbGF0ZWZvcm0nKSkpCiAgICAgICAgICAgICAgICAgICAgZGl2LnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICBYVFJlc2V0KCk7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBjaGFuZ2VUYWJsZShmb3JtLCBmc2VsZWN0aWQsIGVsKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgb2RpdiA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgc3RyZGIgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIGRiYXNlID0gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBmaWVsZHMgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIHRhYmlkID0gLTE7CiAgICAgICAgICAgICAgICB2YXIgZmllbGRzb3B0aW9ucyA9ICIiOwogICAgICAgICAgICAgICAgdmFyIHNlbGVjdCA9IGZvcm1bZnNlbGVjdGlkXTsKICAgICAgICAgICAgICAgIGlmKHNlbGVjdCkgc2VsZWN0Lm9wdGlvbnMubGVuZ3RoID0gMTsKICAgICAgICAgICAgICAgIGlmKGZvcm0gJiYgKG9kaXYgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZGF0YWJhc2UnKSkgCiAgICAgICAgICAgICAgICAgICAgJiYgKHN0cmRiID0gb2Rpdi5nZXRBdHRyaWJ1dGUoJ2RiYXNlJykpICYmIChkYmFzZSA9IGV2YWwoc3RyZGIpKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZigodGFiaWQgPSBlbC5vcHRpb25zW2VsLnNlbGVjdGVkSW5kZXhdLnZhbHVlKSA+PSAwIAogICAgICAgICAgICAgICAgICAgICAgICAmJiAoZmllbGRzID0gZGJhc2VbJ3RhYmxlcyddW3RhYmlkXVsnZmllbGRzJ10pCiAgICAgICAgICAgICAgICAgICAgICAgICYmIHNlbGVjdCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IoeCBpbiBmaWVsZHMpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdC5vcHRpb25zW2krK10gPSBuZXcgT3B0aW9uKGZpZWxkc1t4XVsnbmFtZSddLCB4KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KGZpZWxkc29wdGlvbnMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBzZWxlY3RVUkwoZm9ybSwgYm94LCBpZCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYoZm9ybSAmJiBib3ggJiYgaWQgPj0gMCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZihib3guY2hlY2tlZCA9PSB0cnVlKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9ybVsnaXNfdW5pcWVfJytpZF0uZGlzYWJsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9ybVsnaXNfbGlzdF8nK2lkXS5kaXNhYmxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICAgICBmb3JtWydpc19maWxlXycraWRdLmRpc2FibGVkID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1bJ25vZGVpZF8nK2lkXS5kaXNhYmxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBmb3JtWydpc191bmlxZV8nK2lkXS5kaXNhYmxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1bJ2lzX2xpc3RfJytpZF0uZGlzYWJsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICBmb3JtWydpc19maWxlXycraWRdLmRpc2FibGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9ybVsnbm9kZWlkXycraWRdLmRpc2FibGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBDb25maWdUZW1wbGF0ZShmb3JtKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgcGF0dGVybiA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgYXJyID0gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBjb2RlID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKGZvcm0gJiYgKHBhdHRlcm4gPSBmb3JtWydwYXR0ZXJuJ10udmFsdWUpICYmIChjb2RlID0gZm9ybVsnY29kZSddLnZhbHVlKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBjb2RlID0gY29kZS5yZXBsYWNlKC9ccnxcbi9taWcsJycpOwogICAgICAgICAgICAgICAgICAgIHZhciBub2RlaWQgPSBmb3JtWydub2RlaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgdGFibGVpZCA9IGZvcm1bJ2xpbmtfdGFibGUnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgdGVtcGxhdGVpZCA9IGZvcm1bJ3RlbXBsYXRlaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgdXJsID0gZm9ybVsndXJsJ10udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIG1ldGhvZCA9IGZvcm1bJ21ldGhvZCddLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIHZhciBvcCA9IGZvcm1bJ29wJ10udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIG1hcCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbmRpdGlvbiA9ICJtIjsKICAgICAgICAgICAgICAgICAgICB2YXIgaXNfcHVibGljID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgdmFyIGlzX2lnbm9yZWNhc2UgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICB2YXIgaXNfZ2xvYmFsID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnaXNfcHVibGljJ10uY2hlY2tlZCA9PSB0cnVlKSAKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlzX3B1YmxpYyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX2lnbm9yZWNhc2UnXS5jaGVja2VkID09IHRydWUpIAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaXNfaWdub3JlY2FzZSA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbiArPSAiaSI7IAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZihmb3JtWydpc19nbG9iYWwnXS5jaGVja2VkID09IHRydWUpIAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaXNfZ2xvYmFsID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHJlZyA9IG5ldyAgUmVnRXhwKHBhdHRlcm4sIGNvbmRpdGlvbik7CiAgICAgICAgICAgICAgICAgICAgaWYoKGFyciA9IHJlZy5leGVjKGNvZGUpKSAmJiBhcnIubGVuZ3RoID4gMSkgCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KGZvcm1bJ21hcCddLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnbWFwJ10udmFsdWUpIG1hcCA9IGV2YWwoZm9ybVsnbWFwJ10udmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3JtWyduZmllbGRzJ10udmFsdWUgPSBhcnIubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgb2RpdiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmaWVsZHNvcHRpb25zID0gIiI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjaGlsZHNvcHRpb25zID0gIiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKChvZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2RhdGFiYXNlJykpKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc3RyZGIgPSBvZGl2LmdldEF0dHJpYnV0ZSgnZGJhc2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkYmFzZSA9IGV2YWwoc3RyZGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoZGJhc2UgJiYgZGJhc2VbJ3RhYmxlcyddW3RhYmxlaWRdICYmIHRhYmxlaWQgPj0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IoeCBpbiBkYmFzZVsndGFibGVzJ11bdGFibGVpZF1bJ2ZpZWxkcyddKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRzb3B0aW9ucyArPSAiPG9wdGlvbiB2YWx1ZT0nIit4KyInPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkc29wdGlvbnMgKz0gZGJhc2VbJ3RhYmxlcyddW3RhYmxlaWRdWydmaWVsZHMnXVt4XVsnbmFtZSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIjwvb3B0aW9uPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKG5vZGVpZCA+IDAgJiYgKG9kaXYgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnbm9kZScrbm9kZWlkKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzdHJjaGlsZHMgPSBvZGl2LmdldEF0dHJpYnV0ZSgnY2hpbGRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY2hpbGRzID0gZXZhbChzdHJjaGlsZHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoY2hpbGRzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcih4IGluIGNoaWxkcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkc29wdGlvbnMgKz0gIjxvcHRpb24gdmFsdWU9JyIreCsiJz4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHNvcHRpb25zICs9IGNoaWxkc1t4XSsiIDwvb3B0aW9uPlxuIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYodGVtcGxhdGVpZCA+PSAwKSBvcCA9ICJ0ZW1wbGF0ZV91cGRhdGUiOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgc3RyID0gIjxkaXYgY2xhc3M9J3RlbXBsYXRlLWJhcicgb25tb3VzZWRvd249JyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gImRpdm1vdmUoZXZlbnQsIHRoaXMpJz4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICI8c3BhbiBjbGFzcz0nY2xvc2VidXR0b24nIG9uY2xpY2s9J2RpdnJlbW92ZSgiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICJ0aGlzLnBhcmVudE5vZGUucGFyZW50Tm9kZSknID5YPC9zcGFuPiZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjxzcGFuIGNsYXNzPSdjbG9zZXR4dCcgb25jbGljaz0nZGl2cmVtb3ZlKCI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gInRoaXMucGFyZW50Tm9kZS5wYXJlbnROb2RlKScgPuWFs+mXrTwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICI8L2Rpdj4iOwogICAgICAgICAgICAgICAgICAgICAgIHZhciAgYmxvY2sgPSAiPGRpdiBpZD0ndGVtcGxhdGUtY29uZmlnLWJsb2NrJz4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxmb3JtIGFjdGlvbj0namF2YXNjcmlwdDp2b2lkKDApJyBjbGFzcz0nbGlzdGZvcm0nICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAib25zdWJtaXQ9J0VkaXRUZW1wbGF0ZSh0aGlzLCB0aGlzLnBhcmVudE5vZGUucGFyZW50Tm9kZSknID4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSdub2RlaWQnIHZhbHVlPSciK25vZGVpZCsiJz4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSdvcCcgdmFsdWU9JyIrb3ArIic+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8aW5wdXQgdHlwZT1oaWRkZW4gbmFtZT0nbWV0aG9kJyB2YWx1ZT0nIittZXRob2QrIic+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8aW5wdXQgdHlwZT1oaWRkZW4gbmFtZT0ndGFibGVpZCcgdmFsdWU9JyIrdGFibGVpZCsiJz4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSd0ZW1wbGF0ZWlkJyB2YWx1ZT0nIit0ZW1wbGF0ZWlkKyInPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPGlucHV0IHR5cGU9aGlkZGVuIG5hbWU9J25maWVsZHMnIHZhbHVlPSciK2Fyci5sZW5ndGgrIic+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICImbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIlVSTDo8aW5wdXQgdHlwZT10ZXh0IG5hbWU9J3VybCcgc2l6ZT04MCB2YWx1ZT0nIit1cmwrIic+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8YnI+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICLmqKHniYg6PHRleHRhcmVhIG5hbWU9J3BhdHRlcm4nIGNvbHM9NzYgcm93cz00PiIgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgK3BhdHRlcm4rIjwvdGV4dGFyZWE+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8YnI+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICImbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxpbnB1dCB0eXBlPWNoZWNrYm94IG5hbWU9J2lzX3B1YmxpYycgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGlzX3B1YmxpYykgYmxvY2sgKz0gImNoZWNrZWQiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIj7lhazlhbHmlbDmja4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxpbnB1dCB0eXBlPWNoZWNrYm94IG5hbWU9J2lzX2dsb2JhbCcgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGlzX2dsb2JhbCkgYmxvY2sgKz0gImNoZWNrZWQiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIj7ph43lpI3ljLnphY3lpJrmnaEiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPGlucHV0IHR5cGU9Y2hlY2tib3ggbmFtZT0naXNfaWdub3JlY2FzZScgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGlzX2lnbm9yZWNhc2UpIGJsb2NrICs9ICJjaGVja2VkIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI+5b+955Wl5aSn5bCP5YaZIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8aHI+IjsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSAxOyBpIDwgYXJyLmxlbmd0aDtpKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICImbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoaSA8IDEwKSBibG9jayArPSAnMCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSBpKyI6IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8dGV4dGFyZWEgbmFtZT0ncl8iK2krIicgY29scz03NiByb3dzPTEgcmVhZG9ubHkvZGlzYWJsZWQ+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9IGFycltpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8L3RleHRhcmVhPjxicj4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPHNwYW4gdGl0bGU9J+iHquWKqOaLvOaOpeS4uuWujOaIkOmTvuaOpSc+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8aW5wdXQgdHlwZT1jaGVja2JveCBuYW1lPSdpc191cmxfIitpKyInIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcCAmJiBtYXBbaS0xXVsnZmxhZyddICYgMSkgYmxvY2sgKz0gIiBjaGVja2VkICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiIG9uY2xpY2s9J3NlbGVjdFVSTCh0aGlzLmZvcm0sdGhpcywiK2krIiknPumTvuaOpTwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxzcGFuIHRpdGxlPSfpk77mjqXmoIfor4bkuIDmnaHlrozmlbTkv6Hmga/nmoTnu5PmnZ8nPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPGlucHV0IHR5cGU9Y2hlY2tib3ggbmFtZT0naXNfdW5pcWVfIitpKyInIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcCAmJiBtYXBbaS0xXVsnZmxhZyddICYgMSkgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYobWFwW2ktMV1bJ2ZsYWcnXSAmIDMyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiIGNoZWNrZWQgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiBkaXNhYmxlZD10cnVlICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPuagh+ivhuaAp+mTvuaOpTwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPHNwYW4gdGl0bGU9J+WIl+ihqOmhteWwhuS8muS8mOWFiOS4i+i9veW5tuS4lOS8muWumuacn+abtOaWsCc+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8aW5wdXQgdHlwZT1jaGVja2JveCBuYW1lPSdpc19saXN0XyIraSsiJyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihtYXAgJiYgbWFwW2ktMV1bJ2ZsYWcnXSAmIDEpIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcFtpLTFdWydmbGFnJ10gJiA2NCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiBjaGVja2VkICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICIgZGlzYWJsZWQ9dHJ1ZSAiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIj7liJfooajpobU8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICImbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxzcGFuIHRpdGxlPSfkuIvovb3lrZjlgqjkuLrmlofku7bmr5TlpoI65Zu+54mHLG1wM+etiSc+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8aW5wdXQgdHlwZT1jaGVja2JveCBuYW1lPSdpc19maWxlXyIraSsiJyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihtYXAgJiYgbWFwW2ktMV1bJ2ZsYWcnXSAmIDEpIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcFtpLTFdWydmbGFnJ10gJiAyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiIGNoZWNrZWQgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiBkaXNhYmxlZD10cnVlICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPuaWh+S7tjwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPHNwYW4gdGl0bGU9J+WOu+aOiWh0bWzmoIfnrb7lkI7nmoTmlofmnKzlhoXlrrknPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPGlucHV0IHR5cGU9Y2hlY2tib3ggbmFtZT0naXNfbmVlZF9jbGVhcmh0bWxfIitpKyInIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcCAmJiBtYXBbaS0xXVsnZmxhZyddICYgNCkgYmxvY2sgKz0gIiBjaGVja2VkICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPuWOu0hUTUw8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICImbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxzcGFuIHRpdGxlPSfljrvmjonnlpHkvLzlub/lkYrnmoTpg6jliIblhoXlrrnvvIzor6Xlip/og73osKjmhY7kvb/nlKgnPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPGlucHV0IHR5cGU9Y2hlY2tib3ggbmFtZT0naXNfbmVlZF9hbnRpc3BhbV8iK2krIiciOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYobWFwICYmIG1hcFtpLTFdWydmbGFnJ10gJiA4KSBibG9jayArPSAiIGNoZWNrZWQgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI+5Y675bm/5ZGKPC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPGJyPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8c2VsZWN0IG5hbWU9J2ZpZWxkaWRfIitpKyInPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPG9wdGlvbiB2YWx1ZT0nLTEnIHNlbGVjdGVkPuWvueW6lOWtl+autTwvb3B0aW9uPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihtYXAgJiYgdGFibGVpZCA+PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcih4IGluIGRiYXNlWyd0YWJsZXMnXVt0YWJsZWlkXVsnZmllbGRzJ10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPG9wdGlvbiB2YWx1ZT0nIit4KyInICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcCAmJiBtYXBbaS0xXVsnZmllbGRpZCddID09IHgpIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIiBzZWxlY3RlZCAiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPiIrZGJhc2VbJ3RhYmxlcyddW3RhYmxlaWRdWydmaWVsZHMnXVt4XVsnbmFtZSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIjwvb3B0aW9uPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9IGZpZWxkc29wdGlvbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPC9zZWxlY3Q+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8c2VsZWN0IG5hbWU9J25vZGVpZF8iK2krIicgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcCAmJiAobWFwW2ktMV1bJ2ZsYWcnXSAmIDEpKSBibG9jayArPSAiICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGJsb2NrICs9ICIgZGlzYWJsZWQgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8b3B0aW9uIHZhbHVlPSctMScgc2VsZWN0ZWQ+5YWz6IGU6IqC54K5PC9vcHRpb24+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IoeCBpbiBjaGlsZHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPG9wdGlvbiB2YWx1ZT0nIit4KyInICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcCAmJiBtYXBbaS0xXVsnbm9kZWlkJ10gPT0geCkgYmxvY2sgKz0gIiBzZWxlY3RlZCAiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPiIrIGNoaWxkc1t4XSsiIDwvb3B0aW9uPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9IGNoaWxkc29wdGlvbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPC9zZWxlY3Q+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8aHI+IjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgKz0gIjxpbnB1dCB0eXBlPXN1Ym1pdCB2YWx1ZT0nT0snID4iOwogICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPC9mb3JtPjwvZGl2PiI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGVtcGxhdGUtY29uZmlnJykpKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5ib2R5LnJlbW92ZUNoaWxkKGVsZW1lbnQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5pbm5lckhUTUwgPSBzdHIgKyBibG9jazsKICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5pZCA9ICd0ZW1wbGF0ZS1jb25maWcnOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZGl2d2lkdGggPSA3MDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvYm9keSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdtYWluZnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHhsZWZ0ID0gcGFyc2VJbnQob2JvZHkub2Zmc2V0V2lkdGgpIC0gZGl2d2lkdGg7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gb2JvZHkub2Zmc2V0TGVmdCArKHhsZWZ0LzIpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IDIwICsgZG9jdW1lbnQuYm9keS5zY3JvbGxUb3A7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuc3R5bGUubGVmdCA9IHgrJ3B4JzsKICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZS50b3AgPSB5KydweCc7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuc3R5bGUud2lkdGggPSBkaXZ3aWR0aCArICdweCc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoZWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJCRnJhbWUoZWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmcmFtZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpOwogICAgICAgICAgICAgICAgICAgICAgICBmcmFtZS5pZCA9ICd0ZW1wbGF0ZS1jb25maWctZnJhbWUnOwogICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmFwcGVuZENoaWxkKGZyYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWUuY29udGVudFdpbmRvdy5kb2N1bWVudC5vcGVuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lLmNvbnRlbnRXaW5kb3cuZG9jdW1lbnQud3JpdGUoYmxvY2spOwogICAgICAgICAgICAgICAgICAgICAgICBmcmFtZS5jb250ZW50V2luZG93LmRvY3VtZW50LmNsb3NlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICovCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gVGVzdFRlbXBsYXRlKGZvcm0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBwYXR0ZXJuID0gIiI7CiAgICAgICAgICAgICAgICB2YXIgbGluayA9ICIiOwogICAgICAgICAgICAgICAgdmFyIGNvZGUgPSAiIjsKICAgICAgICAgICAgICAgIHZhciBhcnIgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIGNvbmRpdGlvbiA9ICJtIjsKICAgICAgICAgICAgICAgIHZhciBjb3VudCA9IDA7CiAgICAgICAgICAgICAgICB2YXIgaXNfZ2xvYmFsPSAwOwogICAgICAgICAgICAgICAgaWYoZm9ybSAmJiAocGF0dGVybiA9IGZvcm1bJ3BhdHRlcm4nXS52YWx1ZSkKICAgICAgICAgICAgICAgICAgICAmJiAoY29kZSA9IGZvcm1bJ2NvZGUnXS52YWx1ZSkpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcGF0dGVybiA9IHBhdHRlcm4ucmVwbGFjZSgvXHJ8XG4vbWlnLCcnKTsKICAgICAgICAgICAgICAgICAgICBjb2RlID0gY29kZS5yZXBsYWNlKC9ccnxcbi9taWcsJycpOwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX2lnbm9yZWNhc2UnXS5jaGVja2VkID09IHRydWUpIAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb24gKz0gImkiOyAKICAgICAgICAgICAgICAgICAgICBpZihmb3JtWydpc19nbG9iYWwnXS5jaGVja2VkID09IHRydWUpIAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaXNfZ2xvYmFsID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uICs9ICJnIjsgCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIC8vYWxlcnQocGF0dGVybik7CiAgICAgICAgICAgICAgICAgICAgLy9hbGVydChjb25kaXRpb24pOwogICAgICAgICAgICAgICAgICAgIHZhciByZWcgPSBuZXcgIFJlZ0V4cChwYXR0ZXJuLCBjb25kaXRpb24pOwogICAgICAgICAgICAgICAgICAgIHZhciBtYXRjaGVzID0gbmV3IEFycmF5KCk7CiAgICAgICAgICAgICAgICAgICAgaWYoaXNfZ2xvYmFsKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUoKGFyciA9IHJlZy5leGVjKGNvZGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgYXJyLmxlbmd0aCA+IDEpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoYXJyWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoZXNbY291bnQrK10gPSBhcnI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGFyciA9IHJlZy5leGVjKGNvZGUpKSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIGFyci5sZW5ndGggPiAxKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaGVzW2NvdW50KytdID0gYXJyOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmKGNvdW50ID4gMCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzdHIgPSAiPGRpdiBpZD0ndGVtcGxhdGUtdGVzdC1oZWFkZXInIG9ubW91c2Vkb3duPSciOwogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gImRpdm1vdmUoZXZlbnQsIHRoaXMpJz4iOwogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjxzcGFuIGNsYXNzPSdjbG9zZWJ1dHRvbicgb25jbGljaz0nZGl2cmVtb3ZlKCI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAidGhpcy5wYXJlbnROb2RlLnBhcmVudE5vZGUpJyA+WDwvc3Bhbj4mbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjxzcGFuIGNsYXNzPSdjbG9zZXR4dCcgb25jbGljaz0nZGl2cmVtb3ZlKCI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAidGhpcy5wYXJlbnROb2RlLnBhcmVudE5vZGUpJyA+5YWz6ZetPC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7TWF0Y2ggUmVzdWx0IENvdW50OiIrY291bnQrIjwvZGl2PiI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAiPGRpdiBpZD0ndGVtcGxhdGUtbWF0Y2hlcycgPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1cmwgPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgbGluayA9IGZvcm1bJ2xpbmsnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgY291bnQ7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYobGluaykgdXJsID0gbGluazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAiPHNwYW4+cmVzdWx0OiIraSsiPGhyPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IoaiA9IDE7IGogPCBtYXRjaGVzW2ldLmxlbmd0aDsgaisrKSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihqIDwgMTApIHN0ciArPSAiMCI7IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSBqKyI6PHRleHRhcmVhIGNvbHM9NzYgcm93cz0xPiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgK21hdGNoZXNbaV1bal0rIjwvdGV4dGFyZWE+PGJyPiI7ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGxpbmspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWcgPSBuZXcgUmVnRXhwKCI8IitqKyI+IiwgImlnIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IHVybC5yZXBsYWNlKHJlZywgbWF0Y2hlc1tpXVtqXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYodXJsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAiVVJMOjxpbnB1dCB0eXBlPXRleHQgc2l6ZT00OCB2YWx1ZT0nIit1cmwrIic+PGJyPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjwvc3Bhbj48aHI+IjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjwvZGl2PiI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGVtcGxhdGUtdGVzdCcpKSkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZChlbGVtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuaW5uZXJIVE1MID0gc3RyOwogICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmlkID0gJ3RlbXBsYXRlLXRlc3QnOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZGl2d2lkdGggPSA3MDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvYm9keSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdtYWluZnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHhsZWZ0ID0gcGFyc2VJbnQob2JvZHkub2Zmc2V0V2lkdGgpIC0gZGl2d2lkdGg7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gb2JvZHkub2Zmc2V0TGVmdCArKHhsZWZ0LzIpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IDIwICsgZG9jdW1lbnQuYm9keS5zY3JvbGxUb3A7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuc3R5bGUubGVmdCA9IHgrJ3B4JzsKICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZS50b3AgPSB5KydweCc7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuc3R5bGUud2lkdGggPSBkaXZ3aWR0aCArICdweCc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoZWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJCRnJhbWUoZWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmcmFtZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpOwogICAgICAgICAgICAgICAgICAgICAgICBmcmFtZS5pZCA9ICd0ZW1wbGF0ZS12aWV3ZXInOwogICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmFwcGVuZENoaWxkKGZyYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5mb2N1cygpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYmxvY2sgPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgY291bnQ7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYobGluaykgdXJsID0gbGluazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsb2NrICs9ICI8c3BhbiBjbGFzcz0nY3R4dF9ibG9jayc+UmVzdWx0OiIraSsiIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcihqID0gMTsgaiA8IG1hdGNoZXNbaV0ubGVuZ3RoOyBqKyspIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGogPCAxMCkgYmxvY2sgKz0gIjAiOyAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSBqKyI6PHRleHRhcmVhIGNvbHM9NzYgcm93cz0xPiIgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICttYXRjaGVzW2ldW2pdKyI8L3RleHRhcmVhPjxicj4iOyAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihsaW5rKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVnID0gbmV3IFJlZ0V4cCgiPCIraisiPiIsICJpZyIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwucmVwbGFjZShyZWcsIG1hdGNoZXNbaV1bal0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHVybCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiVVJMOjxpbnB1dCB0eXBlPXRleHQgc2l6ZT00OCB2YWx1ZT0nIit1cmwrIic+PGJyPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jayArPSAiPC9zcGFuPjxocj4iOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lLmNvbnRlbnRXaW5kb3cuZG9jdW1lbnQub3BlbigpOwogICAgICAgICAgICAgICAgICAgICAgICBmcmFtZS5jb250ZW50V2luZG93LmRvY3VtZW50LndyaXRlKGJsb2NrKTsKICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWUuY29udGVudFdpbmRvdy5kb2N1bWVudC5jbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFNob3dUZW1wbGF0ZXModHh0KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgYXJyID0gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBlZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ25vZGUtdGVtcGxhdGUnKTsKICAgICAgICAgICAgICAgIGlmKGVkaXYpIGVkaXYuaW5uZXJIVE1MID0gIiI7CiAgICAgICAgICAgICAgICBpZih0eHQgJiYgZWRpdiAmJiAoYXJyID0gZXZhbCh0eHQpKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KHR4dCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHRlbXAgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHZhciBub2RlaWQgPSBhcnJbJ2lkJ107CiAgICAgICAgICAgICAgICAgICAgdmFyIHRlbXBpZCA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGZsYWcgPSAwOwogICAgICAgICAgICAgICAgICAgIHZhciBwYXR0ZXJuID0gIiI7CiAgICAgICAgICAgICAgICAgICAgdmFyIG1hcCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIHN0cm1hcCA9ICIiOwogICAgICAgICAgICAgICAgICAgIHZhciB0YWJsZWlkID0gMDsKICAgICAgICAgICAgICAgICAgICB2YXIgbmZpZWxkcyA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIHVybCA9ICIiOwogICAgICAgICAgICAgICAgICAgIHZhciBsaW5rID0gIiI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGxpbmttYXAgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHZhciBzdHJsaW5rbWFwID0gIiI7CiAgICAgICAgICAgICAgICAgICAgdmFyIG5hbWUgPSBhcnJbJ25hbWUnXTsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5mb3Jtc1sndGVtcGxhdGVmb3JtJ11bJ25vZGVpZCddLnZhbHVlID0gbm9kZWlkOwogICAgICAgICAgICAgICAgICAgIHZhciBodG1sc3RyID0gICI8dWwgY2xhc3M9J3VsdGFiJyA+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPGxpIGNsYXNzPSd0ZW1wbGF0ZS1oZWFkZXInPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIui+k+WFpVVSTOa1i+ivleaooeeJiCI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIueEtuWQjua3u+WKoOWIsCZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gbmFtZSArICJbIiArIGFyclsnbnRlbXBsYXRlcyddICsgIl0iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L2xpPiI7CiAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgYXJyWydudGVtcGxhdGVzJ107IGkrKykKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRlbXAgPSBhcnJbJ3RlbXBsYXRlcyddW2ldOwogICAgICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuID0gYmFzZTY0c3RyZGVjb2RlKHRlbXBbJ3BhdHRlcm4nXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZsYWcgPSB0ZW1wWydmbGFncyddOwogICAgICAgICAgICAgICAgICAgICAgICB0ZW1waWQgPSB0ZW1wWydpZCddOwogICAgICAgICAgICAgICAgICAgICAgICB0YWJsZWlkID0gdGVtcFsndGFibGVpZCddOwogICAgICAgICAgICAgICAgICAgICAgICBtYXAgPSB0ZW1wWydtYXAnXTsKICAgICAgICAgICAgICAgICAgICAgICAgbGlua21hcCA9IHRlbXBbJ2xpbmttYXAnXTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RybWFwID0gIiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKG1hcC5sZW5ndGggPiAwKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJtYXAgPSAie1siOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yKHggaW4gbWFwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm1hcCArPSAie2ZpZWxkaWQ6IittYXBbeF1bJ2ZpZWxkaWQnXSsgIiwiIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIm5vZGVpZDoiK21hcFt4XVsnbm9kZWlkJ10rICIsIiAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyJmbGFnOiIrbWFwW3hdWydmbGFnJ10rICJ9IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih4IDwgKG1hcC5sZW5ndGggLSAxKSkgc3RybWFwICs9ICIsIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm1hcCArPSAiXX0iOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmxpbmttYXAgPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYobGlua21hcCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RybGlua21hcCA9ICIoeyIgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyJmaWVsZGlkOiciK2xpbmttYXBbJ2ZpZWxkaWQnXSsiJywiIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsibm9kZWlkOiciK2xpbmttYXBbJ25vZGVpZCddKyInLCIgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyJmbGFnOiciK2xpbmttYXBbJ2ZsYWcnXSsiJyIgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyJ9KSI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0gdGVtcFsndXJsJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmsgPSB0ZW1wWydsaW5rJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKGklMikgY3NzbmFtZSA9ICdsdGVtcGxhdGUnOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGNzc25hbWUgPSAnbHRlbXBsYXRlLWhsJzsKICAgICAgICAgICAgICAgICAgICAgICAgbmZpZWxkcyA9IHRlbXBbJ25maWVsZHMnXSsxOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8Zm9ybSBhY3Rpb249J2phdmFzY3JpcHQ6dm9pZCgwKScgY2xhc3M9J2xpc3Rmb3JtJyAiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICIgbmFtZT0neGZvcm0iK3RlbXBpZCsiJyBvbnN1Ym1pdD0nWFRFZGl0KHRoaXMpJz4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8bGkgY2xhc3M9JyIrY3NzbmFtZSsiJyA+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPHRleHRhcmVhIG5hbWU9J3BhdHRlcm4nIGNvbHM9ODAgcm93cz0xIHJlYWRvbmx5L2Rpc2FibGVkID4iIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgK3BhdHRlcm4rIjwvdGV4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yIrdXJsKyInPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdldXBkYXRlJyB0aXRsZT0nQ2hhbmdlJyAiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICJvbmNsaWNrPVwiWFRFZGl0KCd4Zm9ybSIrdGVtcGlkKyInKVwiID4iK2NocmVkaXQrIjwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0nZWRlbGV0ZScgdGl0bGU9J0RlbGV0ZScgIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAib25jbGljaz0nWFREZWxldGUoIitub2RlaWQrIiwgIit0ZW1waWQrIiknPiIrY2hyZGVsKyI8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC9saT4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L2Zvcm0+IjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC91bD4iOwogICAgICAgICAgICAgICAgICAgIGVkaXYuaW5uZXJIVE1MID0gaHRtbHN0cjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBWaWV3VGVtcGxhdGVzKG5vZGVpZCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIG9sZG5vZGVpZCA9IGRvY3VtZW50LmZvcm1zWyd0ZW1wbGF0ZWZvcm0nXVsnbm9kZWlkJ10udmFsdWU7CiAgICAgICAgICAgICAgICBpZihvbGRub2RlaWQgIT0gbm9kZWlkKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIEhpZGRlblRlbXBsYXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGb2xkKGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdmb2xkXycrbm9kZWlkKSk7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7CiAgICAgICAgICAgICAgICBpZihub2RlaWQgPiAwICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXRlbXBsYXRlX2xpc3Qmbm9kZWlkPSIrbm9kZWlkOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaG93VGVtcGxhdGVzKHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBYVEFkZChub2RlaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vZWRpdCBMaW5rCiAgICAgICAgICAgIGZ1bmN0aW9uIEVkaXRMaW5rKGZvcm0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBsaW5rID0gIiI7CiAgICAgICAgICAgICAgICBpZihmb3JtICYmIChsaW5rID0gZm9ybVsnbGluayddLnZhbHVlKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgb3AgPSBmb3JtWydvcCddLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIHZhciBub2RlaWQgPSBmb3JtWydub2RlaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgdGFibGVpZCA9IGZvcm1bJ2xpbmtfdGFibGUnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgdGVtcGxhdGVpZCA9IGZvcm1bJ3RlbXBsYXRlaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgcGF0dGVybiA9IGZvcm1bJ3BhdHRlcm4nXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgbGluayA9IGZvcm1bJ2xpbmsnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgdXJsID0gZm9ybVsndXJsJ10udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGZsYWcgPSA4OwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX3B1YmxpYyddLmNoZWNrZWQgPT0gdHJ1ZSkgZmxhZyB8PSAxOwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX2dsb2JhbCddLmNoZWNrZWQgPT0gdHJ1ZSkgZmxhZyB8PSAyOwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX2lnbm9yZWNhc2UnXS5jaGVja2VkID09IHRydWUpIGZsYWcgfD0gNDsKICAgICAgICAgICAgICAgICAgICBpZihmb3JtWydtZXRob2QnXS52YWx1ZSA9PSAxKSBmbGFnIHw9IDE2OwogICAgICAgICAgICAgICAgICAgIHZhciBsaW5rX2ZsYWcgPSAwOwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2xpbmtfbWV0aG9kJ11bMV0uY2hlY2tlZCA9PSB0cnVlKSBsaW5rX2ZsYWcgfD0gMTY7CiAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnbGlua19saXN0J10uY2hlY2tlZCA9PSB0cnVlKSBsaW5rX2ZsYWcgfD0gNjQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGxpbmttYXAgPSAiWyIgKyBmb3JtWydsaW5rX2ZpZWxkJ10udmFsdWUgKyAnLCcKICAgICAgICAgICAgICAgICAgICAgICAgKyBmb3JtWydsaW5rX25vZGUnXS52YWx1ZSArICcsJwogICAgICAgICAgICAgICAgICAgICAgICArIGxpbmtfZmxhZyArICddJzsKICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KGxpbmttYXApOwogICAgICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB2YXIgYXJndiA9ICJub2RlaWQ9Iitub2RlaWQrIiZ0YWJsZWlkPSIrdGFibGVpZCsiJmZsYWc9IitmbGFnCiAgICAgICAgICAgICAgICAgICAgICAgICsiJmxpbmttYXA9IitlbmNvZGVVUklDb21wb25lbnQobGlua21hcCkKICAgICAgICAgICAgICAgICAgICAgICAgKyImbGluaz0iK2VuY29kZVVSSUNvbXBvbmVudChsaW5rKQogICAgICAgICAgICAgICAgICAgICAgICArIiZwYXR0ZXJuPSIrZW5jb2RlVVJJQ29tcG9uZW50KHBhdHRlcm4pOwogICAgICAgICAgICAgICAgICAgIGlmKHVybCkgYXJndiArPSAiJnVybD0iK2VuY29kZVVSSUNvbXBvbmVudCh1cmwpOwogICAgICAgICAgICAgICAgICAgIGlmKG9wID09ICd0ZW1wbGF0ZV9hZGQnKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgYXJndiArPSAiJm9wPXRlbXBsYXRlX2FkZCI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYob3AgPT0gJ3RlbXBsYXRlX3VwZGF0ZScpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBhcmd2ICs9ICImb3A9dGVtcGxhdGVfdXBkYXRlJnRlbXBsYXRlaWQ9Iit0ZW1wbGF0ZWlkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlbHNlIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICAgICBpZihhcmd2ICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LVR5cGUiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vbnJlYWR5c3RhdGVjaGFuZ2U9ZnVuY3Rpb24oKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYob3AgPT0gJ3RlbXBsYXRlX2FkZCcpIFJlc2V0VGVtcGxhdGVmb3JtKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgSGlkZGVuVGVtcGxhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2hvd1RlbXBsYXRlcyh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy9lZGl0IHRlbXBsYXRlCiAgICAgICAgICAgIGZ1bmN0aW9uIEVkaXRUZW1wbGF0ZShmb3JtLCBlbGVtZW50KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgb3AgPSBmb3JtWydvcCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIG5vZGVpZCA9IGZvcm1bJ25vZGVpZCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIHRlbXBsYXRlaWQgPSBmb3JtWyd0ZW1wbGF0ZWlkJ10udmFsdWU7CiAgICAgICAgICAgICAgICB2YXIgdGFibGVpZCA9IGZvcm1bJ3RhYmxlaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgIHZhciBwYXR0ZXJuID0gZm9ybVsncGF0dGVybiddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIHVybCA9IGZvcm1bJ3VybCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIG1ldGhvZCA9IGZvcm1bJ21ldGhvZCddLnZhbHVlOwogICAgICAgICAgICAgICAgdmFyIGZsYWcgPSAwOwogICAgICAgICAgICAgICAgaWYoZm9ybVsnaXNfcHVibGljJ10uY2hlY2tlZCA9PSB0cnVlKSBmbGFnIHw9IDE7CiAgICAgICAgICAgICAgICBpZihmb3JtWydpc19nbG9iYWwnXS5jaGVja2VkID09IHRydWUpIGZsYWcgfD0gMjsKICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX2lnbm9yZWNhc2UnXS5jaGVja2VkID09IHRydWUpIGZsYWcgfD0gNDsKICAgICAgICAgICAgICAgIGlmKG1ldGhvZCA9PSAxKSBmbGFnIHw9IDE2OwogICAgICAgICAgICAgICAgdmFyIG5maWVsZHMgPSBmb3JtWyduZmllbGRzJ10udmFsdWU7CiAgICAgICAgICAgICAgICB2YXIgZmllbGRpZCA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgaXNfdXJsID0gMDsKICAgICAgICAgICAgICAgIHZhciBpc19maWxlID0gMDsKICAgICAgICAgICAgICAgIHZhciBpc19uZWVkX2NsZWFyaHRtbCA9IDA7CiAgICAgICAgICAgICAgICB2YXIgaXNfbmVlZF9hbnRpc3BhbSA9IDA7CiAgICAgICAgICAgICAgICB2YXIgY2hpbGRfbm9kZWlkID0gMDsKICAgICAgICAgICAgICAgIHZhciBjaGlsZF9mbGFnID0gMDsKICAgICAgICAgICAgICAgIHZhciBtYXAgPSAieyI7CiAgICAgICAgICAgICAgICBmb3IoaSA9IDE7IGkgPCBuZmllbGRzOyBpKyspCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZmllbGRpZCA9ICBmb3JtWydmaWVsZGlkXycraV0udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgbm9kZV9mbGFnID0gMDsKICAgICAgICAgICAgICAgICAgICBub2RlX2lkID0gLTE7CiAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnaXNfdXJsXycraV0uY2hlY2tlZCA9PSB0cnVlKSAKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVfZmxhZyB8PSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpZihmb3JtWydpc191bmlxZV8nK2ldLmNoZWNrZWQgPT0gdHJ1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVfZmxhZyB8PSAzMjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnaXNfZmlsZV8nK2ldLmNoZWNrZWQgPT0gdHJ1ZSkgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlX2ZsYWcgfD0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnaXNfbGlzdF8nK2ldLmNoZWNrZWQgPT0gdHJ1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVfZmxhZyB8PSA2NDsKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZV9pZCA9IGZvcm1bJ25vZGVpZF8nK2ldLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZihmb3JtWydpc19uZWVkX2NsZWFyaHRtbF8nK2ldLmNoZWNrZWQgPT0gdHJ1ZSkgCiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVfZmxhZyB8PSA0OwogICAgICAgICAgICAgICAgICAgIGlmKGZvcm1bJ2lzX25lZWRfYW50aXNwYW1fJytpXS5jaGVja2VkID09IHRydWUpIAogICAgICAgICAgICAgICAgICAgICAgICBub2RlX2ZsYWcgfD0gODsKICAgICAgICAgICAgICAgICAgICBtYXAgKz0gIlsiK2ZpZWxkaWQrIiwiK25vZGVfaWQrIiwiK25vZGVfZmxhZysiXSI7CiAgICAgICAgICAgICAgICAgICAgaWYoaSA8IChuZmllbGRzIC0gMSkpIG1hcCArPSAiOyI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBtYXAgKz0gIn0iOwogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIGFyZ3YgPSAibm9kZWlkPSIrbm9kZWlkKyImdGFibGVpZD0iK3RhYmxlaWQrIiZmbGFnPSIgCiAgICAgICAgICAgICAgICAgICAgK2ZsYWcrIiZtYXA9IitlbmNvZGVVUklDb21wb25lbnQobWFwKQogICAgICAgICAgICAgICAgICAgICsiJnBhdHRlcm49IitlbmNvZGVVUklDb21wb25lbnQocGF0dGVybik7CiAgICAgICAgICAgICAgICBpZih1cmwpIGFyZ3YgKz0gIiZ1cmw9IitlbmNvZGVVUklDb21wb25lbnQodXJsKTsKICAgICAgICAgICAgICAgIGlmKG9wID09ICd0ZW1wbGF0ZV9hZGQnKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGFyZ3YgKz0gIiZvcD10ZW1wbGF0ZV9hZGQiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZihvcCA9PSAndGVtcGxhdGVfdXBkYXRlJykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBhcmd2ICs9ICImb3A9dGVtcGxhdGVfdXBkYXRlJnRlbXBsYXRlaWQ9Iit0ZW1wbGF0ZWlkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICAgICBpZihhcmd2ICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoYXJndik7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpdnJlbW92ZShlbGVtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihvcCA9PSAndGVtcGxhdGVfYWRkJykgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlc2V0VGVtcGxhdGVmb3JtKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSGlkZGVuVGVtcGxhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaG93VGVtcGxhdGVzKHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNlbmQoYXJndik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICAvL2RhdGFiYXNlCiAgICAgICAgICAgIGZ1bmN0aW9uIHNlbGVjdFZpZXcoZGl2LCBlKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgZWxpc3QgPSBuZXcgQXJyYXkoJ3Rhc2tpbmZvJywnZGF0YWJhc2UnLCAndGVtcGxhdGUnLCAKICAgICAgICAgICAgICAgICAgICAndXJsYmxvY2snLCAnZGF0YScsICdkbnMnLCAncHJveHknLCAndXNlcicpOwogICAgICAgICAgICAgICAgZSA9IGUgfHwgd2luZG93LmV2ZW50OwogICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBlLnRhcmdldCB8fCBlLnNyY0VsZW1lbnQ7CiAgICAgICAgICAgICAgICB2YXIgb2xpID0gbnVsbCwgb2IgPSBudWxsLCBvZGl2ID0gbnVsbDsKICAgICAgICAgICAgICAgIGhpZGVCRnJhbWUoKTsKICAgICAgICAgICAgICAgIGZvcihpID0gMDsgaSA8IGVsaXN0Lmxlbmd0aDsgaSsrKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlmKChvbGkgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGFiJytpKSkpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZihvbGkgPT0gZWxlbWVudCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9saS5jbGFzc05hbWUgPSAndGFiLXNlbGVjdGVkJzsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9saS5jbGFzc05hbWUgPSAnJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYoZGl2ID09IGVsaXN0W2ldKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgb2IgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChlbGlzdFtpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG9iLnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgb2RpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGVsaXN0W2ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgb2Rpdi5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICBpZihlbGlzdFtpXSA9PSAndGFza2luZm8nKSAKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYob1RpbWVyKSB3aW5kb3cuY2xlYXJJbnRlcnZhbChvVGltZXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb1RpbWVyID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmKGVsaXN0W2ldID09ICdkYXRhYmFzZScpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkaXZmb3JtID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2RiZm9ybScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoZGl2Zm9ybSkgZGl2Zm9ybS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGRpdmZvcm0gPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZGJmaWVsZGZvcm0nKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGl2Zm9ybS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYoZWxpc3RbaV0gPT0gJ3RlbXBsYXRlJykKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRpdmZvcm0gPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndHh0Zm9ybScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoZGl2Zm9ybSkgZGl2Zm9ybS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGRpdmZvcm0gPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGVtcGxhdGUtdGVzdCcpKSkgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGl2Zm9ybS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGRpdmZvcm0gPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndGVtcGxhdGUtY29uZmlnJykpKSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXZmb3JtLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZihlbGlzdFtpXSA9PSAndXJsYmxvY2snKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZGl2Zm9ybSA9ICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndXJsbGlzdC1mb3JtJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihkaXZmb3JtKSBkaXZmb3JtLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZigoZGl2Zm9ybSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdyZWNvcmQtdmlldycpKSkgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGl2Zm9ybS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYoZGl2ID09ICd0YXNraW5mbycpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgLy9hbGVydCgnT0snKTsKICAgICAgICAgICAgICAgICAgICBsb2FkVGFza0luZm8oKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYoZGl2ID09ICdkYXRhYmFzZScpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG9kYiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdkYnNlbGVjdCcpOwogICAgICAgICAgICAgICAgICAgIGlmKG9kYi5pbm5lckhUTUwgPT0gJycpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBMaXN0VGFibGVzKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZihkaXYgPT0gJ3RlbXBsYXRlJykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdHJlZWJvZHkgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndHJlZWJvZHknKTsKICAgICAgICAgICAgICAgICAgICBpZih0cmVlYm9keS5pbm5lckhUTUwgPT0gJycpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBBZGROb2RlKC0xLDAsIlJvb3QiLDApOwogICAgICAgICAgICAgICAgICAgICAgICBGb2xkKGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdmb2xkXzAnKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZihkaXYgPT0gJ3VybGJsb2NrJykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdXJsYmxvY2sgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndXJsYmxvY2snKTsKICAgICAgICAgICAgICAgICAgICBpZih1cmxibG9jaykKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVybGJsb2NrLnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHVybGxpc3QgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndXJsLWxpc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYodXJsbGlzdC5pbm5lckhUTUwgPT0gJycpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdmFyIGZvcm0gPSBkb2N1bWVudC5mb3Jtc1sndXJsYmxvY2tmb3JtJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBMaXN0UE5vZGVzKDApOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZihkaXYgPT0gJ2RhdGEnKQogICAgICAgICAgICAgICAgewoKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYoZGl2ID09ICdkbnMnKQogICAgICAgICAgICAgICAgLy8mJiBvYi5pbm5lckhUTUwgPT0gJycpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgUmVzZXRETlNMaXN0KCk7CiAgICAgICAgICAgICAgICAgICAgTGlzdEROUygpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZihkaXYgPT0gJ3Byb3h5JykKICAgICAgICAgICAgICAgIC8vJiYgb2IuaW5uZXJIVE1MID09ICcnKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIFJlc2V0UHJveHlMaXN0KCk7CiAgICAgICAgICAgICAgICAgICAgTGlzdFByb3h5KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKGRpdiA9PSAndXNlcicpCiAgICAgICAgICAgICAgICB7CgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGxvYWRUYXNrSW5mbygpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFZpZXdUYXNrKCd0YXNrX3ZpZXcnKTsKICAgICAgICAgICAgICAgIG9UaW1lciA9IHdpbmRvdy5zZXRJbnRlcnZhbCgiVmlld1Rhc2soJ3Rhc2tfdmlldycpIiwgMTAwMDApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEdldENvbnRlbnQodXJsKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7CiAgICAgICAgICAgICAgICBpZihhcmd2ICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignR0VUJywgdXJsLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICAvL3htbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1MZW5ndGgiLCBhcmd2Lmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgLy94bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGVydCh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKG51bGwpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIEhpZGRlbkRCRmllbGRmb3JtKCk7CiAgICAgICAgICAgIH0KCSAgICAgICAgZnVuY3Rpb24gZ2V0RnJhbWVEb2N1bWVudChpZCkKCSAgICAgICAgewoJICAgICAgICAgICAgdmFyIGlmcmFtZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGlkKTsKCSAgICAgICAgICAgIHZhciBEb2MgPSBudWxsOwoJICAgICAgICAgICAgaWYoaWZyYW1lKQoJICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBicm93c2VyID0gbmF2aWdhdG9yLmFwcE5hbWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIHZlcnNpb24gPSBuYXZpZ2F0b3IuYXBwVmVyc2lvbjsKICAgICAgICAgICAgICAgICAgICBpZih2ZXJzaW9uLm1hdGNoKC9NU0lFL2kpICYmIGlmcmFtZS5jb250ZW50V2luZG93KSAvL0lFCgkgICAgICAgICAgICAgICAgewoJICAgICAgICAgICAgICAgICAgICBEb2MgPSBpZnJhbWUuY29udGVudFdpbmRvdy5kb2N1bWVudDsKCSAgICAgICAgICAgICAgICB9CgkgICAgICAgICAgICAgICAgZWxzZSBpZihpZnJhbWUuY29udGVudERvY3VtZW50KSAvLyBGb3IgTlM2CgkgICAgICAgICAgICAgICAgewoJICAgICAgICAgICAgICAgICAgICBEb2MgPSBpZnJhbWUuY29udGVudERvY3VtZW50OwoJICAgICAgICAgICAgICAgIH0KCSAgICAgICAgICAgICAgICBlbHNlIGlmKGlmcmFtZS5kb2N1bWVudCkKCSAgICAgICAgICAgICAgICB7CgkgICAgICAgICAgICAgICAgICAgIERvYyA9IGlmcmFtZS5kb2N1bWVudDsKCSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZSByZXR1cm4gbnVsbDsKCSAgICAgICAgICAgICAgICBpZihEb2MpCgkgICAgICAgICAgICAgICAgewoJICAgICAgICAgICAgICAgICAgICBpZihEb2MuZGVzaWduTW9kZSkgRG9jLmRlc2lnbk1vZGUgPSAnT24nOwoJICAgICAgICAgICAgICAgICAgICBpZihEb2MuY29udGVudEVkaXRhYmxlKSBEb2MuY29udGVudEVkaXRhYmxlID0gdHJ1ZTsKCSAgICAgICAgICAgICAgICB9CgkgICAgICAgICAgICB9CgkgICAgICAgICAgICByZXR1cm4gRG9jOwoJICAgICAgICB9CgkgICAgICAgIGZ1bmN0aW9uIGdldFNlbGVjdENvbnRlbnQoaWQpCgkgICAgICAgIHsKCSAgICAgICAgICAgIHZhciBEb2MgPSBnZXRGcmFtZURvY3VtZW50KGlkKTsKCSAgICAgICAgICAgIGlmKERvYykKCSAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZihEb2MuZ2V0U2VsZWN0aW9uKQogICAgICAgICAgICAgICAgICAgIHsKCSAgICAgICAgICAgICAgICAgICAgYWxlcnQoRG9jLmdldFNlbGVjdGlvbigpLnBhcmVudE5vZGUuaW5uZXJIVE1MKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZihEb2Muc2VsZWN0aW9uKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgYWxlcnQoRG9jLnNlbGVjdGlvbi5wYXJlbnROb2RlLmlubmVySFRNTCk7CiAgICAgICAgICAgICAgICAgICAgfQoJICAgICAgICAgICAgfQoJICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFZpZXdTZWxlY3QoZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZSA9IGUgfHwgd2luZG93LmV2ZW50OwogICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBlLnRhcmdldCB8fCBlLnNyY0VsZW1lbnQ7CiAgICAgICAgICAgICAgICBpZihlbGVtZW50LmlubmVySFRNTCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBhbGVydChlbGVtZW50LnBhcmVudE5vZGUuaW5uZXJIVE1MKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBMb2FkTGlua09wdGlvbnMoKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgbm9kZWlkID0gLTE7CiAgICAgICAgICAgICAgICB2YXIgdGFibGVpZCA9IC0xOwogICAgICAgICAgICAgICAgdmFyIGZsYWcgPSAwOwogICAgICAgICAgICAgICAgdmFyIG9kaXYgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIGxpbmttYXAgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIG9zZWxlY3QgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIGRiYXNlID0gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBmb3JtID0gZG9jdW1lbnQuZm9ybXNbJ3RlbXBsYXRlZm9ybSddOwogICAgICAgICAgICAgICAgaWYoZm9ybSAmJiAobm9kZWlkID0gZm9ybVsnbm9kZWlkJ10udmFsdWUpID4gMCApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnbGlua21hcCddLnZhbHVlKSBsaW5rbWFwID0gZXZhbChmb3JtWydsaW5rbWFwJ10udmFsdWUpOwogICAgICAgICAgICAgICAgICAgIGZsYWcgPSBmb3JtWydmbGFnJ10udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgdGFibGVpZCA9IGZvcm1bJ3RhYmxlaWQnXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBpZigob2RpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdkYXRhYmFzZScpKQogICAgICAgICAgICAgICAgICAgICAgICAmJiAoc3RyZGIgPSBvZGl2LmdldEF0dHJpYnV0ZSgnZGJhc2UnKSkgCiAgICAgICAgICAgICAgICAgICAgICAgICYmIChkYmFzZSA9IGV2YWwoc3RyZGIpKSkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0YWJsZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIG9zZWxlY3QgPSBmb3JtWydsaW5rX3RhYmxlJ107CiAgICAgICAgICAgICAgICAgICAgICAgIG9zZWxlY3Qub3B0aW9ucy5sZW5ndGggPSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yKHggaW4gZGJhc2VbJ3RhYmxlcyddKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJsZSA9IGRiYXNlWyd0YWJsZXMnXVt4XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zZWxlY3Qub3B0aW9uc1tpXSA9IG5ldyBPcHRpb24odGFibGVbJ25hbWUnXSwgeCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihsaW5rbWFwICYmIHggPT0gdGFibGVpZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc2VsZWN0Lm9wdGlvbnNbaV0uc2VsZWN0ZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgKytpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKGxpbmttYXAgJiYgdGFibGVpZCAgPj0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZpZWxkcyA9IGRiYXNlWyd0YWJsZXMnXVt0YWJsZWlkXVsnZmllbGRzJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc2VsZWN0ID0gZm9ybVsnbGlua19maWVsZCddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3NlbGVjdC5vcHRpb25zLmxlbmd0aCA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcih4IGluIGZpZWxkcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc2VsZWN0Lm9wdGlvbnNbaV0gPSBuZXcgT3B0aW9uKGZpZWxkc1t4XVsnbmFtZSddLCB4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihsaW5rbWFwICYmIGZsYWcgPj0gMCAmJiAoZmxhZyAmIDgpICYmIHggPT0gbGlua21hcFsnZmllbGRpZCddKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3NlbGVjdC5vcHRpb25zW2ldLnNlbGVjdGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKytpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBzdHJjaGlsZHMgPSAiIjsKICAgICAgICAgICAgICAgICAgICB2YXIgY2hpbGRzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZihub2RlaWQgPiAwICYmIChvZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ25vZGUnK25vZGVpZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICYmIChzdHJjaGlsZHMgPSBvZGl2LmdldEF0dHJpYnV0ZSgnY2hpbGRzJykpIAogICAgICAgICAgICAgICAgICAgICAgICAmJiAoY2hpbGRzID0gZXZhbChzdHJjaGlsZHMpKSApCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KHN0cmNoaWxkcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoZm9ybVsnbGlua21hcCddLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgb3NlbGVjdCA9IGZvcm1bJ2xpbmtfbm9kZSddOwogICAgICAgICAgICAgICAgICAgICAgICBvc2VsZWN0Lm9wdGlvbnMubGVuZ3RoID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoY2hpbGRzKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcih4IGluIGNoaWxkcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc2VsZWN0Lm9wdGlvbnNbaV0gPSBuZXcgT3B0aW9uKGNoaWxkc1t4XSwgeCk7IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGxpbmttYXAgJiYgeCA9PSBsaW5rbWFwWydub2RlaWQnXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zZWxlY3Qub3B0aW9uc1tpXS5zZWxlY3RlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsraTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KHN0cmNoaWxkcyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgkJICAgIGZ1bmN0aW9uIExvYWRVUkwoZm9ybSkKCQkgICAgewoJCSAgICAgICAgdmFyIHVybCA9IGZvcm1bJ3VybCddLnZhbHVlOwoJCSAgICAgICAgaWYodXJsKQoJCSAgICAgICAgewoJCSAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKCQkgICAgICAgICAgICBpZigoeG1sSHR0cCA9IENyZWF0ZVhNTEhUVFAoKSkgIT0gbnVsbCkKCQkgICAgICAgICAgICB7CgkJICAgICAgICAgICAgICAgIHZhciByZXF1ZXN0VVJMID0gJy9wcm94eS8nK3VybDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGFyZ3YgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbWV0aG9kID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoZm9ybVsnbWV0aG9kJ11bMV0uY2hlY2tlZCA9PSB0cnVlKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcG9zID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZCA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZigocG9zID0gdXJsLmluZGV4T2YoJz8nKSkgPj0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0VVJMID0gJy9wcm94eS8nK3VybC5zdWJzdHJpbmcoMCwgcG9zLTEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3YgPSB1cmwuc3Vic3RyaW5nKHBvcyArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RVUkwgPSAnL3Byb3h5LycrdXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3YgPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KCQkgICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsIHJlcXVlc3RVUkwsIHRydWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgewoJCSAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFVSTCA9ICcvcHJveHkvJyt1cmw7CgkJICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9wZW4oJ0dFVCcsIHJlcXVlc3RVUkwsIHRydWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJndiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KCQkgICAgICAgICAgICAgICAgeG1sSHR0cC5vbnJlYWR5c3RhdGVjaGFuZ2U9ZnVuY3Rpb24oKQoJCSAgICAgICAgICAgICAgICB7CgkJICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCgkJICAgICAgICAgICAgICAgICAgICB7CgkJICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQoJCSAgICAgICAgICAgICAgICAgICAgICAgIHsKCQkgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHN0ciA9IHhtbEh0dHAucmVzcG9uc2VUZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZWRpdiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKChlZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3NvdXJjZV9jb2RlX29wJykpKSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVkaXYuc3R5bGUuZGlzcGxheSA9ICJpbmxpbmUiOwoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzb3VyY2VfdmlldycpOwoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihlbGVtZW50KSBlbGVtZW50LmlubmVySFRNTCA9ICIiOwoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZigoZWRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCd0ZW1wbGF0ZWRpdicpKSkgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVkaXYuc3R5bGUuZGlzcGxheSA9ICJpbmxpbmUiOwoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuZm9ybXNbJ3RlbXBsYXRlZm9ybSddWydjb2RlJ10udmFsdWUgPSBzdHI7CgkJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5mb3Jtc1sndGVtcGxhdGVmb3JtJ11bJ3VybCddLnZhbHVlID0gdXJsOwoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuZm9ybXNbJ3RlbXBsYXRlZm9ybSddWydtZXRob2QnXS52YWx1ZSA9IG1ldGhvZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZnJhbWUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJpZnJhbWUiKTsKCQkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lLnNldEF0dHJpYnV0ZSgiaWQiLCAnZWRpdG9yLWZyYW1lJyk7CgkJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZS5zZXRBdHRyaWJ1dGUoInNyYyIsICdhYm91dDpibGFuaycpOwoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5hcHBlbmRDaGlsZChmcmFtZSk7CgkJICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkb2MgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZigoZG9jID0gZ2V0RnJhbWVEb2N1bWVudCgnZWRpdG9yLWZyYW1lJykpKQoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaHRtbHN0ciA9IHN0cjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHN0ci5tYXRjaCgvPGJhc2UgLio/aHJlZj0uKj8+L2kpID09IG51bGwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGJhc2V1cmwgPSB1cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBvc3QgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKChwb3MgPSB1cmwubGFzdEluZGV4T2YoJy8nKSkgPiA2KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFzZXVybCA9IHVybC5zdWJzdHJpbmcoMCwgcG9zKzEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYmFzZWhyZWYgPSAiPGhlYWQ+PGJhc2UgaHJlZj0nIitiYXNldXJsKyInPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciA9IHN0ci5yZXBsYWNlKC88aGVhZD4vaSwgYmFzZWhyZWYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQoJCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jLm9wZW4oKTsKCQkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvYy53cml0ZShodG1sc3RyKTsKCQkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvYy5jbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CgkJICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CgkJICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmZvcm1zWyd0ZW1wbGF0ZWZvcm0nXVsnY29kZSddLnZhbHVlIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSB4bWxIdHRwLmdldEFsbFJlc3BvbnNlSGVhZGVycygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KCQkgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJfd2FpdCgpOwoJCSAgICAgICAgICAgICAgICB9CgkJICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRfd2FpdCgpOwoJCSAgICAgICAgICAgIH0KCQkgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBWaWV3RGF0YWJhc2UoKTsKCQkgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBSZXNldERpdihpZCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGlkKTsKICAgICAgICAgICAgICAgIGlmKGRpdikgZGl2LmlubmVySFRNTCA9ICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFJlc2V0VVJMTGlzdCgpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBmb3JtID0gZG9jdW1lbnQuZm9ybXNbJ3VybGJsb2NrZm9ybSddOwogICAgICAgICAgICAgICAgaWYoZm9ybSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBSZXNldERpdigndXJsLWxpc3QnKTsKICAgICAgICAgICAgICAgICAgICBmb3JtWydsZXZlbCddLm9wdGlvbnNbMF0uc2VsZWN0ZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgIGZvcm1bJ3VybCddLmZvY3VzKCk7CiAgICAgICAgICAgICAgICAgICAgZm9ybVsndXJsJ10udmFsdWUgPSAnaHR0cDovLyc7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTGlzdFBOb2Rlcyhub2RlaWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBmb3JtID0gZG9jdW1lbnQuZm9ybXNbJ3VybGJsb2NrZm9ybSddOwogICAgICAgICAgICAgICAgaWYoZm9ybSAmJiBub2RlaWQgPj0gMCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYXJndiA9ICIiOwogICAgICAgICAgICAgICAgICAgIGlmKG5vZGVpZCA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3YgPSAib3A9bm9kZV9icm90aGVyJm5vZGVpZD0iK25vZGVpZDsKICAgICAgICAgICAgICAgICAgICBlbHNlIAogICAgICAgICAgICAgICAgICAgICAgICBhcmd2ID0gIm9wPW5vZGVfY2hpbGRzJm5vZGVpZD0iK25vZGVpZDsKICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KGFyZ3YpOwogICAgICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZihhcmd2ICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LVR5cGUiLCAKICAgICAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnN0YXR1cyA9PSAyMDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL1Jlc2V0VVJMTGlzdCgpOyAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9hbGVydCh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0bm9kZSA9IGV2YWwoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgb3NlbGVjdCA9IGZvcm1bJ25vZGVpZCddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihvc2VsZWN0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc2VsZWN0Lm9wdGlvbnMubGVuZ3RoID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gMCwgeCA9IDEsIHRpZCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdG5hbWUgPSAiLi4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYodG5vZGVbJ2lkJ10gPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zZWxlY3Qub3B0aW9uc1t4KytdPW5ldyBPcHRpb24odG5hbWUsIHRub2RlWydpZCddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcihpID0gMDsgaSA8IHRub2RlWyduY2hpbGRzJ107IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aWQgPSB0bm9kZVsnY2hpbGRzJ11baV1bJ2lkJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG5hbWUgPSB0bm9kZVsnY2hpbGRzJ11baV1bJ25hbWUnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihub2RlaWQgPT0gdGlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc2VsZWN0Lm9wdGlvbnNbeF0gPSBuZXcgT3B0aW9uKHRuYW1lLCB0aWQsIHRydWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3NlbGVjdC5vcHRpb25zW3hdID0gbmV3IE9wdGlvbih0bmFtZSwgdGlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArK3g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG1vdmVDaGlsZE5vZGVzKGZvcm0sIG5vZGVpZCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIG9saXN0ID0gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBvY2hpbGRzID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKGZvcm0gJiYgKG9saXN0ID0gZm9ybVsnbm9kZWlkJ10pICYmIChvY2hpbGRzID0gZm9ybVsnY2hpbGRzJ10pKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIG9saXN0Lm9wdGlvbnMubGVuZ3RoID0gMTsKICAgICAgICAgICAgICAgICAgICB4ID0gMTsKICAgICAgICAgICAgICAgICAgICBmb3IoaSA9IDE7IGkgPCBvY2hpbGRzLm9wdGlvbnMubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICB0bmFtZSA9IG9jaGlsZHMub3B0aW9uc1tpXS50ZXh0OwogICAgICAgICAgICAgICAgICAgICAgICB0aWQgPSBvY2hpbGRzLm9wdGlvbnNbaV0udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHRpZCA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHRuYW1lID09ICcqJykgdG5hbWUgPSAnLi4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYobm9kZWlkID09IHRpZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbGlzdC5vcHRpb25zW3grK10gPSBuZXcgT3B0aW9uKHRuYW1lLCB0aWQsIHRydWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbGlzdC5vcHRpb25zW3grK10gPSBuZXcgT3B0aW9uKHRuYW1lLCB0aWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9jaGlsZHMub3B0aW9ucy5sZW5ndGggPSAxOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIExpc3ROb2RlVVJMcyhmb3JtLCBvbmFtZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIG5vZGVpZCA9IC0xOwogICAgICAgICAgICAgICAgdmFyIGxldmVsID0gLTE7CiAgICAgICAgICAgICAgICB2YXIgb3NlbGVjdCA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgaW5kZXggPSAwOwogICAgICAgICAgICAgICAgdmFyIG90ZXh0ID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKGZvcm0gJiYgKG9zZWxlY3QgPSBmb3JtW29uYW1lXSkgJiYgKGluZGV4ID0gb3NlbGVjdC5zZWxlY3RlZEluZGV4KSA+IDAgCiAgICAgICAgICAgICAgICAgICAgJiYgKG5vZGVpZCA9IG9zZWxlY3Qub3B0aW9uc1tpbmRleF0udmFsdWUpID49IDAgCiAgICAgICAgICAgICAgICAgICAgJiYgKG90ZXh0ID0gb3NlbGVjdC5vcHRpb25zW2luZGV4XS50ZXh0KSAhPSAnKicpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWYob25hbWUgPT0gJ2NoaWxkcycpIG1vdmVDaGlsZE5vZGVzKGZvcm0sIG5vZGVpZCk7CiAgICAgICAgICAgICAgICAgICAgbGV2ZWwgPSBmb3JtWydsZXZlbCddLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIFJlc2V0VVJMTGlzdCgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBMaXN0VVJMcygnbGlzdCcsIG5vZGVpZCwgbGV2ZWwsIDEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFZpZXdDaGlsZHNVUkwodXJsbm9kZWlkLCBsZXZlbCwgcGFnZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOyAKICAgICAgICAgICAgICAgIGlmKHVybG5vZGVpZCA+PSAwICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIFJlc2V0VVJMTGlzdCgpOwogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXVybG5vZGVfY2hpbGRzJnVybG5vZGVpZD0iK3VybG5vZGVpZCsiJnBhZ2U9IitwYWdlOwogICAgICAgICAgICAgICAgICAgIGlmKGxldmVsID49IDApIGFyZ3YgKz0gIiZsZXZlbD0iK2xldmVsOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaG93Tm9kZVVSTHMoeG1sSHR0cC5yZXNwb25zZVRleHQsIHBhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICAKICAgICAgICAgICAgZnVuY3Rpb24gTGlzdFVSTHModHlwZSwgbm9kZWlkLCBsZXZlbCwgcGFnZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOyAKICAgICAgICAgICAgICAgIGlmKG5vZGVpZCA+PSAwICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIFJlc2V0VVJMTGlzdCgpOwogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIiI7CiAgICAgICAgICAgICAgICAgICAgaWYodHlwZSA9PSAnbGlzdCcpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBhcmd2ID0gIm9wPXVybG5vZGVfbGlzdCZub2RlaWQ9Iitub2RlaWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3YgPSAib3A9dXJsbm9kZV9jaGlsZHMmdXJsbm9kZWlkPSIrbm9kZWlkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhcmd2ICs9ICImcGFnZT0iK3BhZ2U7CiAgICAgICAgICAgICAgICAgICAgaWYobGV2ZWwgPj0gMCkgYXJndiArPSAiJmxldmVsPSIrbGV2ZWw7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3dOb2RlVVJMcyh4bWxIdHRwLnJlc3BvbnNlVGV4dCwgcGFnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFZpZXdSZWNvcmRzKHR4dCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIG5yZWNvcmRzID0gMDsKICAgICAgICAgICAgICAgIHZhciByZXMgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIHJlY29yZHMgPSBudWxsOwogICAgICAgICAgICAgICAgdmFyIHggPSAwOwogICAgICAgICAgICAgICAgaWYodHh0ICYmIChyZXMgPSBldmFsKHR4dCkpICE9IG51bGwgJiYgKHJlY29yZHMgPSByZXNbJ3JlY29yZHMnXSkgCiAgICAgICAgICAgICAgICAgICAgJiYgKG5yZWNvcmRzID0gcmVzWyducmVjb3JkcyddKSA+IDApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHN0ciA9ICI8ZGl2IGlkPSdyZWNvcmQtaGVhZGVyJyBvbm1vdXNlZG93bj0nIjsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICJkaXZtb3ZlKGV2ZW50LCB0aGlzKSc+IjsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICI8c3BhbiBjbGFzcz0nY2xvc2VidXR0b24nIG9uY2xpY2s9J2RpdnJlbW92ZSgiOwogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gInRoaXMucGFyZW50Tm9kZS5wYXJlbnROb2RlKScgPlg8L3NwYW4+Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICI8c3BhbiBjbGFzcz0nY2xvc2V0eHQnIG9uY2xpY2s9J2RpdnJlbW92ZSgiOwogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gInRoaXMucGFyZW50Tm9kZS5wYXJlbnROb2RlKScgPuWFs+mXrTwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwO+e7k+aenDoiK25yZWNvcmRzKyI8L2Rpdj4iOwogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjxkaXYgaWQ9J3JlY29yZC1yZXMnID4iOwogICAgICAgICAgICAgICAgICAgIGZvcih4IGluIHJlY29yZHMpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjxzcGFuIGNsYXNzPSdyZWNvcmQtdGl0bGUnPiIrcmVjb3Jkc1t4XVsnbmFtZSddKyI8L3NwYW4+PGhyPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAiPHNwYW4gPiIKICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICI8dGV4dGFyZWEgY29scz05MCByb3dzPTQgPiIrYmFzZTY0c3RyZGVjb2RlKHJlY29yZHNbeF1bJ2RhdGEnXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICsiPC90ZXh0YXJlYT48YnI+IjsgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAiPC9zcGFuPjxocj4iOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBzdHIgKz0gIjwvZGl2PiI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGlmKChlbGVtZW50ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3JlY29yZC12aWV3JykpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZChlbGVtZW50KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxlbWVudCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpOwogICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuaW5uZXJIVE1MID0gc3RyOwogICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuaWQgPSAncmVjb3JkLXZpZXcnOwogICAgICAgICAgICAgICAgICAgIHZhciBkaXZ3aWR0aCA9IDc1MDsKICAgICAgICAgICAgICAgICAgICB2YXIgb2JvZHkgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnbWFpbmZyYW1lJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHhsZWZ0ID0gcGFyc2VJbnQob2JvZHkub2Zmc2V0V2lkdGgpIC0gZGl2d2lkdGg7CiAgICAgICAgICAgICAgICAgICAgdmFyIHggPSBvYm9keS5vZmZzZXRMZWZ0ICsoeGxlZnQvMik7CiAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSAyMCArIGRvY3VtZW50LmJvZHkuc2Nyb2xsVG9wOwogICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuc3R5bGUubGVmdCA9IHgrJ3B4JzsKICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnN0eWxlLnRvcCA9IHkrJ3B4JzsKICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnN0eWxlLndpZHRoID0gZGl2d2lkdGggKyAncHgnOwogICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoZWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZS5kaXNwbGF5ID0gJ2lubGluZSc7CiAgICAgICAgICAgICAgICAgICAgb3ZlckJGcmFtZShlbGVtZW50KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBWaWV3UmVjb3JkKHJlY29yZGlkKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7IAogICAgICAgICAgICAgICAgaWYocmVjb3JkaWQgPiAwICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXJlY29yZF92aWV3JnJlY29yZGlkPSIrcmVjb3JkaWQ7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdSZWNvcmRzKHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNlbmQoYXJndik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLyogU2hvdyBOb2RlIFVSTHMgKi8KICAgICAgICAgICAgZnVuY3Rpb24gU2hvd05vZGVVUkxzKHR4dCwgcGFnZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGZvcm0gPSBkb2N1bWVudC5mb3Jtc1sndXJsYmxvY2tmb3JtJ107CiAgICAgICAgICAgICAgICB2YXIgdXJsbGlzdCA9IG51bGw7CiAgICAgICAgICAgICAgICBpZih0eHQgJiYgZm9ybSAmJiAodXJsbGlzdCA9IGV2YWwodHh0KSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBSZXNldFVSTExpc3QoKTsgCiAgICAgICAgICAgICAgICAgICAgdmFyIHVybGl0ZW0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHZhciBub2RlaWQgPSAtMTsKICAgICAgICAgICAgICAgICAgICB2YXIgdG5hbWUgPSAiIjsKICAgICAgICAgICAgICAgICAgICB2YXIgbmNoaWxkcyA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIHVybG5vZGVpZCA9IC0xOwogICAgICAgICAgICAgICAgICAgIHZhciByZWNvcmRpZCA9IC0xOwogICAgICAgICAgICAgICAgICAgIHZhciBvY2hpbGRzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDAsIHggPSAxOwogICAgICAgICAgICAgICAgICAgIGlmKChvY2hpbGRzID0gZm9ybVsnY2hpbGRzJ10pKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZWlkID0gdXJsbGlzdFsnbm9kZWlkJ107CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwaWQgPSB1cmxsaXN0WydwYXJlbnQnXTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG9ub2RlID0gZm9ybVsnbm9kZWlkJ107CiAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQocGlkKyI6Iitub2RlaWQrIjoiK29ub2RlLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYob25vZGUub3B0aW9uc1tvbm9kZS5zZWxlY3RlZEluZGV4XS50ZXh0ID09ICcuLicgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBvbm9kZS5vcHRpb25zW29ub2RlLnNlbGVjdGVkSW5kZXhdLnZhbHVlICE9IG5vZGVpZCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTGlzdFBOb2Rlcyhub2RlaWQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAwLCB4ID0gMSwgeiA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgIG9jaGlsZHMub3B0aW9ucy5sZW5ndGggPSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpZih1cmxsaXN0WydudG5vZGVzJ10gPiAwKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihub2RlaWQgPiAwKW9jaGlsZHMub3B0aW9uc1t4KytdID0gbmV3IE9wdGlvbignKicsIG5vZGVpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgb2xpc3RjaGlsZHMgPSBkb2N1bWVudC5mb3Jtc1sndXJsbGlzdC1hZGQtZm9ybSddWydub2RlaWQnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG9saXN0Y2hpbGRzKSBvbGlzdGNoaWxkcy5vcHRpb25zLmxlbmd0aCA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IoaSBpbiB1cmxsaXN0Wyd0bm9kZXMnXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlaWQgPSB1cmxsaXN0Wyd0bm9kZXMnXVtpXVsnaWQnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bmFtZSA9IHVybGxpc3RbJ3Rub2RlcyddW2ldWyduYW1lJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmNoaWxkcyA9IHVybGxpc3RbJ3Rub2RlcyddW2ldWyduY2hpbGRzJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2NoaWxkcy5vcHRpb25zW3grK10gPSBuZXcgT3B0aW9uKHRuYW1lLCBub2RlaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKG9saXN0Y2hpbGRzKSAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2xpc3RjaGlsZHMub3B0aW9uc1t6KytdID0gbmV3IE9wdGlvbih0bmFtZSwgbm9kZWlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgaHRtbHN0ciA9ICI8dWwgY2xhc3M9J3VybC11bCc+IjsKICAgICAgICAgICAgICAgICAgICB2YXIgZnJvbSA9IDAsIHRvID0gMDsKICAgICAgICAgICAgICAgICAgICB2YXIgcGh0bWxzdHIgPSAiIjsKICAgICAgICAgICAgICAgICAgICB2YXIgbGV2ZWwgPSAwOwogICAgICAgICAgICAgICAgICAgIHZhciB1cmwgPSAiIjsKICAgICAgICAgICAgICAgICAgICB2YXIgcHBpZCA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIHR5cGUgPSAibGlzdCI7CiAgICAgICAgICAgICAgICAgICAgbGV2ZWwgPSBmb3JtWydsZXZlbCddLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIG5vZGVpZCA9IHVybGxpc3RbJ25vZGVpZCddOwogICAgICAgICAgICAgICAgICAgIGZyb20gPSBwYXJzZUludChwYWdlKSAtIDEwOwogICAgICAgICAgICAgICAgICAgIGlmKGZyb20gPCAxKSBmcm9tID0gMTsKICAgICAgICAgICAgICAgICAgICB0byA9IGZyb20gKyAyMDsKICAgICAgICAgICAgICAgICAgICBpZih0byA+IHVybGxpc3RbJ3BhZ2VzJ10pIHRvID0gcGFyc2VJbnQodXJsbGlzdFsncGFnZXMnXSkgKyAxOwogICAgICAgICAgICAgICAgICAgIHBodG1sc3RyICs9ICI8bGkgY2xhc3M9J3VybGxpLWhlYWRlcic+ICI7CiAgICAgICAgICAgICAgICAgICAgaWYodXJsbGlzdFsnaXNfY2hpbGRzJ10gPiAwKSB0eXBlID0gImNoaWxkcyI7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB0eXBlID0gImxpc3QiOwogICAgICAgICAgICAgICAgICAgIGlmKChwcGlkID0gdXJsbGlzdFsncHBpZCddKSA+IDApIAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGh0bWxzdHIgKz0gIls8YSBocmVmPSdqYXZhc2NyaXB0OjsnIGNsYXNzPSdlYWRkJyBvbmNsaWNrPVwiTGlzdFVSTHMoJyIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICt0eXBlKyInLCIrcHBpZCsiLCAiK2xldmVsKyIsIDEpO1wiPuS4iuS4gOWxgjwvYT5dJm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcGh0bWxzdHIgKz0gIlVSTOaAu+aVsO+8miIrdXJsbGlzdFsndG90YWwnXTsKICAgICAgICAgICAgICAgICAgICBpZih1cmxsaXN0WydwYWdlcyddID4gMSkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBodG1sc3RyICs9ICIg5YWxIit1cmxsaXN0WydwYWdlcyddKyLpobUiOwogICAgICAgICAgICAgICAgICAgICAgICBwaHRtbHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoZnJvbSA+IDIwKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaHRtbHN0ciArPSAiPGEgY2xhc3M9J3VybC1saS1wYWdlJyBocmVmPSdqYXZhc2NyaXB0OjsnICI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaHRtbHN0ciArPSAiIG9uY2xpY2s9XCJMaXN0VVJMcygnIit0eXBlKyInLCAiK25vZGVpZCsiLCciCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgK2xldmVsKyInLCcxJyk7XCI+MTwvYT4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOy4uLiI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSBmcm9tOyBpIDwgdG87IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihpID09IHBhZ2UpIHBodG1sc3RyICs9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBodG1sc3RyICs9ICI8YSBjbGFzcz0ndXJsLWxpLXBhZ2UnIGhyZWY9J2phdmFzY3JpcHQ6OycgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaHRtbHN0ciArPSAib25jbGljaz1cIkxpc3RVUkxzKCciK3R5cGUrIicsICIrbm9kZWlkKyIsJyIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgK2xldmVsKyInLCciK2krIicpO1wiPiIraSsiPC9hPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYodG8gPCAodXJsbGlzdFsncGFnZXMnXSAtIDIwKSkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHVybGxpc3RbJ3BhZ2VzJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaHRtbHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Li4uJm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBodG1sc3RyICs9ICI8YSBjbGFzcz0ndXJsLWxpLXBhZ2UnIGhyZWY9J2phdmFzY3JpcHQ6OycgIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBodG1sc3RyICs9ICJvbmNsaWNrPVwiTGlzdFVSTHMoJyIrdHlwZSsiJywgIitub2RlaWQgKyIsJyIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArbGV2ZWwrIicsJyIraSsiJyk7XCI+IitpKyI8L2E+IjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBwaHRtbHN0ciArPSAiPC9saT4iOwogICAgICAgICAgICAgICAgICAgIGlmKHBodG1sc3RyICE9ICIiKWh0bWxzdHIgKz0gcGh0bWxzdHIgKyAiPGhyPiI7CiAgICAgICAgICAgICAgICAgICAgLy9hbGVydChwaHRtbHN0cik7CiAgICAgICAgICAgICAgICAgICAgaSA9IDA7CiAgICAgICAgICAgICAgICAgICAgZm9yKHggaW4gdXJsbGlzdFsndXJsbm9kZXMnXSkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKICAgICAgICAgICAgICAgICAgICAgICAgdXJsaXRlbSA9IHVybGxpc3RbJ3VybG5vZGVzJ11beF07CiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVpZCA9IHVybGl0ZW1bJ25vZGVpZCddOwogICAgICAgICAgICAgICAgICAgICAgICB1cmxpZCA9IHVybGl0ZW1bJ3VybGlkJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGxldmVsID0gdXJsaXRlbVsnbGV2ZWwnXTsKICAgICAgICAgICAgICAgICAgICAgICAgdXJsbm9kZWlkID0gdXJsaXRlbVsnaWQnXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmVjb3JkaWQgPSB1cmxpdGVtWydyZWNvcmRpZCddOwogICAgICAgICAgICAgICAgICAgICAgICBuY2hpbGRzID0gdXJsaXRlbVsnbmNoaWxkcyddOwogICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmxpdGVtWyd1cmwnXTsKICAgICAgICAgICAgICAgICAgICAgICAgY3NzID0gJ3VybC1saSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHVybGl0ZW1bJ3N0YXR1cyddIDwgMCkgY3NzID0gJ3VybC1saS13YXJuJzsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPGxpIGNsYXNzPSciK2NzcysiJyBvbm1vdXNlb3V0PVwib3V0RGl2KHRoaXMsJyIrY3NzKyInKVwiICI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiBvbm1vdXNlbW92ZT1cIm9uRGl2KHRoaXMsICd1cmwtbGktc2VsZWN0ZWQnKVwiID4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9IGkrIjombmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8YSBocmVmPSciK3VybCsiJyB0YXJnZXQ9J19ibGFuayc+Iit1cmwrIjwvYT4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICBpZihuY2hpbGRzID4gMCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiWzxzcGFuIGNsYXNzPSdldmlldycgIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiIG9uY2xpY2s9XCJWaWV3Q2hpbGRzVVJMKCIrdXJsbm9kZWlkKyIsMCwxKVwiPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9IG5jaGlsZHMrIjwvc3Bhbj5dIjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c2VsZWN0IG5hbWU9J2xldmVsJyBvbmNoYW5nZT1cIlVwZGF0ZU5vZGVVUkwoIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSBub2RlaWQrIiwiK3VybG5vZGVpZCsiLCAiK3VybGlkKyIsIHRoaXMsICIrcGFnZSsiKVwiPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxvcHRpb24gdmFsdWU9Jy0xJyBzZWxlY3RlZD7kvJjlhYjnuqc8L29wdGlvbj4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8b3B0aW9uIHZhbHVlPScwJyAiOwogICAgICAgICAgICAgICAgICAgICAgICBpZihsZXZlbCA9PSAwKSBodG1sc3RyICs9ICJzZWxlY3RlZD10cnVlIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPuaZrumAmjwvb3B0aW9uPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxvcHRpb24gdmFsdWU9JzEnIjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYobGV2ZWwgPT0gMSkgaHRtbHN0ciArPSAic2VsZWN0ZWQ9dHJ1ZSI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIj7ntKfmgKU8L29wdGlvbj4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L3NlbGVjdD4iOwogICAgICAgICAgICAgICAgICAgICAgICBpZihyZWNvcmRpZCA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0nZXZpZXcnIHRpdGxlPSdWaWV3JyAiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAib25jbGljaz1cIlZpZXdSZWNvcmQoIityZWNvcmRpZCsiKVwiPiIrY2hydmlldysiPC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYodXJsbGlzdFsnbnRub2RlcyddID4gMCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiJm5ic3A7Jm5ic3A7Jm5ic3A7IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdlYWRkJyB0aXRsZT0nQWRkJyAiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAib25jbGljaz1cIlhBZGROb2RlVVJMKGV2ZW50LCAiK3VybG5vZGVpZCsiKVwiPiIrY2hyYWRkKyI8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICImbmJzcDsmbmJzcDsmbmJzcDsiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8c3BhbiBjbGFzcz0nZWRlbGV0ZScgdGl0bGU9J0RlbGV0ZScgIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAib25jbGljaz1cIkRlbGV0ZU5vZGVVUkwoIitub2RlaWQrIiwgIit1cmxub2RlaWQrIiwiK3VybGlkKyIsIjsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiJyIrdXJsKyInLCciK3BhZ2UrIicpXCI+IitjaHJkZWwrIjwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L2xpPiI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmKHVybGxpc3RbJ3BhZ2VzJ10gPiAxKSBodG1sc3RyICs9ICI8aHI+IjsKICAgICAgICAgICAgICAgICAgICBpZihwaHRtbHN0ciAhPSAiIilodG1sc3RyICs9IHBodG1sc3RyOwogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjwvdWw+IjsKICAgICAgICAgICAgICAgICAgICB2YXIgZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3VybC1saXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYoZGl2KSBkaXYuaW5uZXJIVE1MID0gaHRtbHN0cjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEhpZGRlblVSTExpc3RGb3JtKCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCd1cmxsaXN0LWZvcm0nKTsKICAgICAgICAgICAgICAgIGlmKGRpdikgZGl2LnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICBoaWRlQkZyYW1lKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gQWRkTm9kZVVSTChmb3JtKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgbm9kZWlkID0gLTE7CiAgICAgICAgICAgICAgICB2YXIgcGFyZW50aWQgPSAtMTsKICAgICAgICAgICAgICAgIHZhciBsZXZlbCA9IC0xOwogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOyAKICAgICAgICAgICAgICAgIGlmKGZvcm0gJiYgKG5vZGVpZCA9IGZvcm1bJ25vZGVpZCddLnZhbHVlKSA+IDAgCiAgICAgICAgICAgICAgICAgICAgJiYgKHVybCA9IGZvcm1bJ3VybCddLnZhbHVlKQogICAgICAgICAgICAgICAgICAgICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXVybG5vZGVfYWRkJm5vZGVpZD0iK25vZGVpZDsKICAgICAgICAgICAgICAgICAgICAgICAgYXJndiArPSAiJnVybD0iK2VuY29kZVVSSUNvbXBvbmVudCh1cmwpOwogICAgICAgICAgICAgICAgICAgIGlmKChwYXJlbnRpZCA9IGZvcm1bJ3BhcmVudGlkJ10udmFsdWUpID49IDApCiAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3YgKz0gIiZwYXJlbnRpZD0iK3BhcmVudGlkOwogICAgICAgICAgICAgICAgICAgIGlmKChsZXZlbCA9IGZvcm1bJ2xldmVsJ10udmFsdWUpID49IDApCiAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3YgKz0gIiZsZXZlbD0iK2xldmVsOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KGFyZ3YpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3dOb2RlVVJMcyh4bWxIdHRwLnJlc3BvbnNlVGV4dCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBIaWRkZW5VUkxMaXN0Rm9ybSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gWEFkZE5vZGVVUkwoZSwgcGFyZW50aWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGUgPSBlIHx8IHdpbmRvdy5ldmVudDsKICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZS50YXJnZXQgfHwgZS5zcmNFbGVtZW50OwogICAgICAgICAgICAgICAgdmFyIFhkaXYgPSAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInVybGxpc3QtZm9ybSIpOwogICAgICAgICAgICAgICAgdmFyIHggPSBlLmNsaWVudFggKyBkb2N1bWVudC5ib2R5LnNjcm9sbExlZnQ7CiAgICAgICAgICAgICAgICB2YXIgeSA9IGUuY2xpZW50WSArIGRvY3VtZW50LmJvZHkuc2Nyb2xsVG9wOwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS5sZWZ0ID0geDsKICAgICAgICAgICAgICAgIFhkaXYuc3R5bGUudG9wID0geSArIDEwOwogICAgICAgICAgICAgICAgWGRpdi5zdHlsZS5kaXNwbGF5ID0gJ2lubGluZSc7CiAgICAgICAgICAgICAgICB2YXIgZm9ybSA9IGRvY3VtZW50LmZvcm1zWyJ1cmxsaXN0LWFkZC1mb3JtIl07CiAgICAgICAgICAgICAgICBmb3JtWydwYXJlbnRpZCddLnZhbHVlID0gcGFyZW50aWQ7CiAgICAgICAgICAgICAgICBmb3JtWyd1cmwnXS5mb2N1cygpOwogICAgICAgICAgICAgICAgZm9ybVsndXJsJ10udmFsdWUgPSAnaHR0cDovLyc7CiAgICAgICAgICAgICAgICBvdmVyQkZyYW1lKFhkaXYpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBVcGRhdGVOb2RlVVJMKG5vZGVpZCwgdXJsbm9kZWlkLCB1cmxpZCwgb3NlbGVjdCwgcGFnZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOyAKICAgICAgICAgICAgICAgIHZhciBpbmRleCA9IChvc2VsZWN0KSA/IG9zZWxlY3Quc2VsZWN0ZWRJbmRleCA6IDA7CiAgICAgICAgICAgICAgICB2YXIgbGV2ZWwgPSAoaW5kZXggPj0gMCkgPyBvc2VsZWN0Lm9wdGlvbnNbaW5kZXhdLnZhbHVlIDogLTE7CiAgICAgICAgICAgICAgICB2YXIgdGV4dCA9IChpbmRleCA+PSAwKT8gb3NlbGVjdC5vcHRpb25zW2luZGV4XS50ZXh0IDogIiI7CiAgICAgICAgICAgICAgICBpZihub2RlaWQgPiAwICYmIHVybG5vZGVpZCA+IDAgJiYgbGV2ZWwgPj0gMAogICAgICAgICAgICAgICAgICAgICYmIGNvbmZpcm0oIuaCqOehruiupOS/ruaUueS8mOWFiOe6p+S4ulsiK3RleHQrIl0/IikKICAgICAgICAgICAgICAgICAgICAmJih4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXVybG5vZGVfdXBkYXRlJm5vZGVpZD0iK25vZGVpZCsiJnVybG5vZGVpZD0iIAogICAgICAgICAgICAgICAgICAgICAgICArdXJsbm9kZWlkKyImdXJsaWQ9Iit1cmxpZCsiJmxldmVsPSIrbGV2ZWw7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3dOb2RlVVJMcyh4bWxIdHRwLnJlc3BvbnNlVGV4dCwgcGFnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gRGVsZXRlTm9kZVVSTChub2RlaWQsIHVybG5vZGVpZCwgdXJsaWQsIHVybCwgcGFnZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOyAKICAgICAgICAgICAgICAgIGlmKG5vZGVpZCA+IDAgJiYgdXJsbm9kZWlkID4gMCAKICAgICAgICAgICAgICAgICAgICAmJiBjb25maXJtKCLmgqjnoa7orqTliKDpmaRVUkxbIit1cmwrIl0gPyIpCiAgICAgICAgICAgICAgICAgICAgJiYoeG1sSHR0cCA9IENyZWF0ZVhNTEhUVFAoKSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPXVybG5vZGVfZGVsZXRlJm5vZGVpZD0iK25vZGVpZCsiJnVybG5vZGVpZD0iCiAgICAgICAgICAgICAgICAgICAgK3VybG5vZGVpZCsiJnVybGlkPSIrdXJsaWQ7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3dOb2RlVVJMcyh4bWxIdHRwLnJlc3BvbnNlVGV4dCwgcGFnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgICAgIFJlc2V0RGl2KCd1cmwtbGlzdCcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gUmVzZXRETlNMaXN0KCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGZvcm0gPSBkb2N1bWVudC5mb3Jtc1snZG5zLWFkZC1mb3JtJ107CiAgICAgICAgICAgICAgICBpZihmb3JtKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGZvcm1bJ2hvc3QnXS5mb2N1cygpOwogICAgICAgICAgICAgICAgICAgIGZvcm1bJ2hvc3QnXS52YWx1ZSA9ICcnOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFNob3dETlModHh0KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgZGl2ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2Rucy1saXN0Jyk7CiAgICAgICAgICAgICAgICB2YXIgb2JqZG5zbGlzdCA9IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgZG5zbGlzdCA9IG51bGw7CiAgICAgICAgICAgICAgICBpZih0eHQgJiYgZGl2ICYmIChvYmpkbnNsaXN0ID0gZXZhbCh0eHQpKSAhPSBudWxsIAogICAgICAgICAgICAgICAgICAgICYmIChkbnNsaXN0ID0gb2JqZG5zbGlzdFsnZG5zbGlzdCddKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBSZXNldEROU0xpc3QoKTsgCiAgICAgICAgICAgICAgICAgICAgdmFyIGhvc3RpZCA9IC0xOwogICAgICAgICAgICAgICAgICAgIHZhciBob3N0ID0gIiI7CiAgICAgICAgICAgICAgICAgICAgdmFyIHN0YXR1cyA9IC0xOwogICAgICAgICAgICAgICAgICAgIHZhciBodG1sc3RyID0gIjx1bCBjbGFzcz0nZG5zLXVsJz4iOwogICAgICAgICAgICAgICAgICAgIGZvcih4IGluIGRuc2xpc3QpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBob3N0aWQgPSBkbnNsaXN0W3hdWydpZCddOwogICAgICAgICAgICAgICAgICAgICAgICBob3N0ID0gIGRuc2xpc3RbeF1bJ2hvc3QnXTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gZG5zbGlzdFt4XVsnc3RhdHVzJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxsaSBjbGFzcz0nZG5zLWxpJyBvbm1vdXNlb3V0PVwib3V0RGl2KHRoaXMsICdkbnMtbGknKVwiICI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiBvbm1vdXNlbW92ZT1cIm9uRGl2KHRoaXMsICdkbnMtbGktc2VsZWN0ZWQnKVwiID4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9IGhvc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHN0YXR1cyA+IDApIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdzdGF0dXNfZXJyJz7mnInmlYg8L3NwYW4+IjsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAgaHRtbHN0ciArPSAiPHNwYW4gY2xhc3M9J3N0YXR1c19vayc+5aSx5pWIPC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdlZGVsZXRlJyB0aXRsZT0nRGVsZXRlJyAiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICJvbmNsaWNrPVwiRGVsZXRlRE5TKCIraG9zdGlkKyIsICciK2hvc3QrIicpXCI+IitjaHJkZWwrIjwvc3Bhbj4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICI8L2xpPiI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjwvdWw+IjsKICAgICAgICAgICAgICAgICAgICBkaXYuaW5uZXJIVE1MID0gaHRtbHN0cjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEFkZEROUyhmb3JtKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgaG9zdCA9ICIiOwogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOyAKICAgICAgICAgICAgICAgIGlmKGZvcm0gJiYgKGhvc3QgPSBmb3JtWydob3N0J10udmFsdWUpIAogICAgICAgICAgICAgICAgICAgICYmICh4bWxIdHRwID0gQ3JlYXRlWE1MSFRUUCgpKSAhPSBudWxsKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHZhciBhcmd2ID0gIm9wPWRuc19hZGQmaG9zdD0iK2hvc3Q7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWxlcnQoYXJndik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2hvd0ROUyh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gRGVsZXRlRE5TKGhvc3RpZCwgaG9zdCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHhtbEh0dHAgPSBudWxsOyAKICAgICAgICAgICAgICAgIGlmKGhvc3RpZCA+PSAwICYmIGhvc3QKICAgICAgICAgICAgICAgICAgICAmJiBjb25maXJtKCLmgqjnoa7orqTliKDpmaRETlNbIitob3N0KyJdID8iKQogICAgICAgICAgICAgICAgICAgICYmKHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCkpICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFyZ3YgPSAib3A9ZG5zX2RlbGV0ZSZob3N0aWQ9Iitob3N0aWQrIiZob3N0PSIraG9zdDsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9wZW4oJ1BPU1QnLCAnLycsIHRydWUpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1MZW5ndGgiLCBhcmd2Lmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LVR5cGUiLCAiYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkIik7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vbnJlYWR5c3RhdGVjaGFuZ2U9ZnVuY3Rpb24oKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5yZWFkeVN0YXRlPT00KQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnN0YXR1cyA9PSAyMDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2hvd0ROUyh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTGlzdEROUygpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsgCiAgICAgICAgICAgICAgICBpZigoeG1sSHR0cCA9IENyZWF0ZVhNTEhUVFAoKSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYXJndiA9ICJvcD1kbnNfbGlzdCI7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vcGVuKCdQT1NUJywgJy8nLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtTGVuZ3RoIiwgYXJndi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAucmVhZHlTdGF0ZT09NCkKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5zdGF0dXMgPT0gMjAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3dETlMoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFJlc2V0UHJveHlMaXN0KCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGZvcm0gPSBkb2N1bWVudC5mb3Jtc1sncHJveHktYWRkLWZvcm0nXTsKICAgICAgICAgICAgICAgIGlmKGZvcm0pCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZm9ybVsnaG9zdCddLmZvY3VzKCk7CiAgICAgICAgICAgICAgICAgICAgZm9ybVsnaG9zdCddLnZhbHVlID0gJyc7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gU2hvd1Byb3h5KHR4dCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIGRpdiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdwcm94eS1saXN0Jyk7CiAgICAgICAgICAgICAgICB2YXIgcHJveHlsaXN0ID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKHR4dCAmJiBkaXYgJiYgKHByb3h5bGlzdCA9IGV2YWwodHh0KSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBSZXNldFByb3h5TGlzdCgpOyAKICAgICAgICAgICAgICAgICAgICB2YXIgaG9zdGlkID0gLTE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGhvc3QgPSAiIjsKICAgICAgICAgICAgICAgICAgICB2YXIgc3RhdHVzID0gLTE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGh0bWxzdHIgPSAiPHVsIGNsYXNzPSdwcm94eS11bCc+IjsKICAgICAgICAgICAgICAgICAgICBmb3IoeCBpbiBwcm94eWxpc3QpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBob3N0aWQgPSBwcm94eWxpc3RbeF1bJ2lkJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGhvc3QgPSAgcHJveHlsaXN0W3hdWydob3N0J107CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IHByb3h5bGlzdFt4XVsnc3RhdHVzJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxsaSBjbGFzcz0ncHJveHktbGknIG9ubW91c2VvdXQ9XCJvdXREaXYodGhpcywgJ3Byb3h5LWxpJylcIiAiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICIgb25tb3VzZW1vdmU9XCJvbkRpdih0aGlzLCAncHJveHktbGktc2VsZWN0ZWQnKVwiID4iOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9IGhvc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHN0YXR1cyA+IDApIGh0bWxzdHIgKz0gIuacieaViCI7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgIGh0bWxzdHIgKz0gIuWunuaViCI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIiZuYnNwOyZuYnNwOyI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjxzcGFuIGNsYXNzPSdlZGVsZXRlJyB0aXRsZT0nRGVsZXRlJyAiOwogICAgICAgICAgICAgICAgICAgICAgICBodG1sc3RyICs9ICJvbmNsaWNrPVwiRGVsZXRlUHJveHkoIitob3N0aWQrIiwgJyIraG9zdCsiJylcIj4iK2NocmRlbCsiPC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWxzdHIgKz0gIjwvbGk+IjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaHRtbHN0ciArPSAiPC91bD4iOwogICAgICAgICAgICAgICAgICAgIGRpdi5pbm5lckhUTUwgPSBodG1sc3RyOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEFkZFByb3h5KGZvcm0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBob3N0ID0gIiI7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7IAogICAgICAgICAgICAgICAgaWYoZm9ybSA9PSBudWxsIHx8IChob3N0PWZvcm1bJ2hvc3QnXS52YWx1ZSkgPT0gIiIgfHwgaG9zdC5pbmRleE9mKCc6JykgPD0gMCkgCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgYWxlcnQoJ+S7o+eQhuacjeWKoeWZqOagvOW8j+S4ujoyMDIuMTA2LjAuMjA6ODg4OCcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmKGhvc3QgJiYgKHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCkpICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFyZ3YgPSAib3A9cHJveHlfYWRkJmhvc3Q9Iitob3N0OwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2FsZXJ0KGFyZ3YpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3dQcm94eSh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZW5kKGFyZ3YpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gRGVsZXRlUHJveHkoaG9zdGlkLCBob3N0KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgeG1sSHR0cCA9IG51bGw7IAogICAgICAgICAgICAgICAgaWYoaG9zdGlkID49IDAgJiYgaG9zdAogICAgICAgICAgICAgICAgICAgICYmIGNvbmZpcm0oIuaCqOehruiupOWIoOmZpOS7o+eQhlsiK2hvc3QrIl0gPyIpCiAgICAgICAgICAgICAgICAgICAgJiYgKHhtbEh0dHAgPSBDcmVhdGVYTUxIVFRQKCkpICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFyZ3YgPSAib3A9cHJveHlfZGVsZXRlJmhvc3RpZD0iK2hvc3RpZCsiJmhvc3Q9Iitob3N0OwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAub3BlbignUE9TVCcsICcvJywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LUxlbmd0aCIsIGFyZ3YubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnJlYWR5U3RhdGU9PTQpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHhtbEh0dHAuc3RhdHVzID09IDIwMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaG93UHJveHkoeG1sSHR0cC5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2VuZChhcmd2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIExpc3RQcm94eSgpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciB4bWxIdHRwID0gbnVsbDsgCiAgICAgICAgICAgICAgICBpZigoeG1sSHR0cCA9IENyZWF0ZVhNTEhUVFAoKSkgIT0gbnVsbCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYXJndiA9ICJvcD1wcm94eV9saXN0IjsKICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLm9wZW4oJ1BPU1QnLCAnLycsIHRydWUpOwogICAgICAgICAgICAgICAgICAgIHhtbEh0dHAuc2V0UmVxdWVzdEhlYWRlcigiQ29udGVudC1MZW5ndGgiLCBhcmd2Lmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LVR5cGUiLCAiYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkIik7CiAgICAgICAgICAgICAgICAgICAgeG1sSHR0cC5vbnJlYWR5c3RhdGVjaGFuZ2U9ZnVuY3Rpb24oKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoeG1sSHR0cC5yZWFkeVN0YXRlPT00KQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih4bWxIdHRwLnN0YXR1cyA9PSAyMDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9hbGVydCh4bWxIdHRwLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2hvd1Byb3h5KHhtbEh0dHAucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB4bWxIdHRwLnNlbmQoYXJndik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQoKICAgIDwvc2NyaXB0PgogICAgPC9oZWFkPgogICAgPCEtLSA8Ym9keSBvbmxvYWQ9J2phdmFzY3JpcHQ6bG9hZEluaXQoKTsnPiAtLT4KPGJvZHkgb25sb2FkPSdqYXZhc2NyaXB0OmxvYWRUYXNrSW5mbygpOyc+CiAgPGRpdiBpZD0nbWFpbmZyYW1lJz4KICAgIDxkaXYgaWQ9J2l0YWInPgogICAgICAgIDx1bD4KICAgICAgICA8bGkgY2xhc3M9J3RhYi1zZWxlY3RlZCcgaWQ9J3RhYjAnIG9uY2xpY2s9InNlbGVjdFZpZXcoJ3Rhc2tpbmZvJyxldmVudCkiID7kuIvovb3ku7vliqE8L2xpPgogICAgICAgIDxsaSBpZD0ndGFiMScgb25jbGljaz0ic2VsZWN0VmlldygnZGF0YWJhc2UnLGV2ZW50KSIgPuaVsOaNruW6k+mFjee9rjwvbGk+CiAgICAgICAgPGxpI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9keScgbGV2ZWw9JzAnPjwvZGl2PgogICAgICAgIDwvdGQ+CiAgICAgICAgPHRkIHZhbGlnbj10b3AgYWxpZ249bGVmdCA+CiAgICAgICAgICAgICAgPGRpdiBpZD0ndGVtcGxhdGUtdGl0bGUnPuaooeeJiOeUqOS6juaKveWPluiHquW3semcgOimgeeahOaVsOaNrjwvZGl2PgogICAgICAgICAgICAgIDxkaXYgaWQ9J25vZGUtdGVtcGxhdGUnPjwvZGl2PgogICAgICAgICAgICAgIDxkaXYgaWQ9J3h0ZW1wbGF0ZWZvcm0nPgogICAgICAgICAgICAgICAgPGRpdiBpZD11cmxmb3JtID4KICAgICAgICAgICAgICAgIDxmb3JtIGFjdGlvbj0namF2YXNjcmlwdDp2b2lkKDApOycgbmFtZT0ndXJsZm9ybScgb25zdWJtaXQ9J3JldHVybiBMb2FkVVJMKHRoaXMpOyc+CiAgICAgICAgICAgICAgICBVUkw6PGlucHV0IHR5cGU9dGV4dCBzaXplPSc2NCcgbmFtZT0ndXJsJz4KICAgICAgICAgICAgICAgICZuYnNwOwogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9cmFkaW8gbmFtZT0nbWV0aG9kJyB2YWx1ZT0nMCcgY2hlY2tlZD5HRVQKICAgICAgICAgICAgICAgICZuYnNwOwogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9cmFkaW8gbmFtZT0nbWV0aG9kJyB2YWx1ZT0nMSc+UE9TVAogICAgICAgICAgICAgICAgJm5ic3A7CiAgICAgICAgICAgICAgICA8aW5wdXQgdHlwZT1zdWJtaXQgdmFsdWU9J0xvYWQnPgogICAgICAgICAgICAgICAgPC9mb3JtPgogICAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgICAgICA8ZGl2IGlkPSdzb3VyY2VfY29kZV9vcCc+CiAgICAgICAgICAgICAgICAgIDxkaXYgaWQ9J3NvdXJjZV92aWV3Jz48L2Rpdj4KICAgICAgICAgICAgICAgICAgPGRpdiBpZD0nc291cmNlX29wJz48L2Rpdj4KICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgPGRpdiBpZD0ndGVtcGxhdGVkaXYnPgogICAgICAgICAgICAgICAgPGZvcm0gbmFtZT0idGVtcGxhdGVmb3JtIiBhY3Rpb249ImphdmFzY3JpcHQ6dm9pZCgwKSIgPgogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9aGlkZGVuIG5hbWU9J29wJyB2YWx1ZT0ndGVtcGxhdGVfYWRkJyA+CiAgICAgICAgICAgICAgICA8aW5wdXQgdHlwZT1oaWRkZW4gbmFtZT0nbm9kZWlkJyB2YWx1ZT0nLTEnID4KICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSd0ZW1wbGF0ZWlkJyB2YWx1ZT0nLTEnID4KICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSd0YWJsZWlkJyB2YWx1ZT0nLTEnID4KICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSdmbGFnJyB2YWx1ZT0nMCcgPgogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9aGlkZGVuIG5hbWU9J25maWVsZHMnIHZhbHVlPSctMScgPgogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9aGlkZGVuIG5hbWU9J21hcCcgdmFsdWU9JycgPgogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9aGlkZGVuIG5hbWU9J2xpbmttYXAnIHZhbHVlPScnID4KICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSd1cmwnIHZhbHVlPScnID4KICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSdtZXRob2QnIHZhbHVlPScnID4KICAgICAgICAgICAgICAgIOS7o+eggTo8dGV4dGFyZWEgbmFtZT0nY29kZScgcm93cz04ICBjb2xzPTEyMD48L3RleHRhcmVhPiAKICAgICAgICAgICAgICAgIDxicj4KICAgICAgICAgICAgICAgIOaooeeJiDo8dGV4dGFyZWEgbmFtZT0ncGF0dGVybicgcm93cz00ICBjb2xzPTEyMD48L3RleHRhcmVhPgogICAgICAgICAgICAgICAgPGJyPgogICAgICAgICAgICAgICAgPHNwYW4gYWxpZ249Y2VudGVyPgogICAgICAgICAgICAgICAgJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7CiAgICAgICAgICAgICAgICA8aW5wdXQgdHlwZT1jaGVja2JveCBuYW1lPSdpc19wdWJsaWMnID7lhazlhbHlrZfmrrUKICAgICAgICAgICAgICAgICZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOwogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9Y2hlY2tib3ggbmFtZT0naXNfZ2xvYmFsJyA+6YeN5aSN5Yy56YWN5aSa5p2hCiAgICAgICAgICAgICAgICAmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsKICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPWNoZWNrYm94IG5hbWU9J2lzX2lnbm9yZWNhc2UnID7lv73nlaXlpKflsI/lhpkKICAgICAgICAgICAgICAgICZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOwogICAgICAgICAgICAgICAgPHNlbGVjdCBuYW1lPSdsaW5rX3RhYmxlJyBvbmNoYW5nZT0iY2hhbmdlVGFibGUodGhpcy5mb3JtLCAnbGlua19maWVsZCcsIHRoaXMpIj4KICAgICAgICAgICAgICAgICAgICA8b3B0aW9uIHZhbHVlPSctMScgc2VsZWN0ZWQ+5pWw5o2u6KGoPC9vcHRpb24+CiAgICAgICAgICAgICAgICA8L3NlbGVjdD4KICAgICAgICAgICAgICAgICZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOwogICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9J2J1dHRvbicgdmFsdWU9J+aooeadv+a1i+ivlScgb25jbGljaz0iVGVzdFRlbXBsYXRlKHRoaXMuZm9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Lya5a6a5pyf5pu05pawJz48aW5wdXQgdHlwZT1jaGVja2JveCBuYW1lPSdsaW5rX2xpc3QnID7liJfooajpobU8L3NwYW4+CiAgICAgICAgICAgICAgICAmbmJzcDsKICAgICAgICAgICAgICAgIDxzZWxlY3QgbmFtZT0nbGlua19maWVsZCcgPgogICAgICAgICAgICAgICAgICAgIDxvcHRpb24gdmFsdWU9Jy0xJyBzZWxlY3RlZD7lrZfmrrU8L29wdGlvbj4KICAgICAgICAgICAgICAgIDwvc2VsZWN0PgogICAgICAgICAgICAgICAgJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7CiAgICAgICAgICAgICAgICA8c2VsZWN0IG5hbWU9J2xpbmtfbm9kZScgPgogICAgICAgICAgICAgICAgICAgIDxvcHRpb24gdmFsdWU9Jy0xJyBzZWxlY3RlZD7lrZDoioLngrk8L29wdGlvbj4KICAgICAgICAgICAgICAgIDwvc2VsZWN0PgogICAgICAgICAgICAgICAgPC9zcGFuPgogICAgICAgICAgICAgICAgPC9mb3JtPgogICAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgIDwvZGl2PgogICAgICAgIDwvdGQ+CiAgICAgICAgPC90cj4KICAgICAgIDwvdGFibGU+CiAgICA8L2Rpdj4KICAgIDxkaXYgaWQ9J3VybGJsb2NrJz4KICAgIDxkaXYgaWQ9J3VybC1oZWFkZXInPgogICAgPGZvcm0gbmFtZT0ndXJsYmxvY2tmb3JtJyBjbGFzcz0nbGlzdGZvcm0nIGFjdGlvbj0namF2YXNjcmlwdDp2b2lkKDApJyAKICAgICAgICAgICAgb25zdWJtaXQ9J3JldHVybiBBZGROb2RlVVJMKHRoaXMpJyA+CiAgICA8aW5wdXQgdHlwZT1oaWRkZW4gbmFtZT0nb3AndmFsdWU9J3VybF9hZGQnID4KICAgIDxpbnB1dCB0eXBlPWhpZGRlbiBuYW1lPSdwYXJlbnRpZCd2YWx1ZT0nMCcgPgogICAgPHNlbGVjdCBuYW1lPSdub2RlaWQn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